GridTableStylesCollection.CollectionChanged 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在集合更改后发生。
public:
event System::ComponentModel::CollectionChangeEventHandler ^ CollectionChanged;
public event System.ComponentModel.CollectionChangeEventHandler CollectionChanged;
member this.CollectionChanged : System.ComponentModel.CollectionChangeEventHandler
Public Custom Event CollectionChanged As CollectionChangeEventHandler
事件类型
示例
下面的代码示例将 CollectionChangeEventHandler 委托添加到 CollectionChanged 事件。
private:
void AddHandler()
{
dataGrid1->TableStyles->CollectionChanged +=
gcnew CollectionChangeEventHandler( this, &Form1::Collection_Changed );
}
void Collection_Changed( Object^ sender, CollectionChangeEventArgs^ e )
{
GridTableStylesCollection^ gts = (GridTableStylesCollection^)(sender);
Console::WriteLine( gts->Count );
}
private void AddHandler()
{
dataGrid1.TableStyles.CollectionChanged +=
new CollectionChangeEventHandler(Collection_Changed);
}
private void Collection_Changed
(object sender, CollectionChangeEventArgs e)
{
GridTableStylesCollection gts = (GridTableStylesCollection)
sender;
Console.WriteLine(gts.Count);
}
Private Sub MyAddHandler()
AddHandler dataGrid1.TableStyles.CollectionChanged, _
AddressOf Collection_Changed
End Sub
Private Sub Collection_Changed _
(sender As Object, e As CollectionChangeEventArgs)
Dim gts As GridTableStylesCollection = _
CType(sender, GridTableStylesCollection)
Console.WriteLine(gts.Count)
End Sub
注解
有关处理事件的详细信息,请参阅 处理和引发事件。