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
備註
如需處理事件的詳細資訊,請參閱 處理和引發事件。