Compartir a través de


GridTableStylesCollection.CollectionChanged Evento

Definición

Se produce cuando cambia la colección.

public:
 event System::ComponentModel::CollectionChangeEventHandler ^ CollectionChanged;
public event System.ComponentModel.CollectionChangeEventHandler CollectionChanged;
member this.CollectionChanged : System.ComponentModel.CollectionChangeEventHandler 
Public Custom Event CollectionChanged As CollectionChangeEventHandler 

Tipo de evento

Ejemplos

En el ejemplo de código siguiente se agrega un CollectionChangeEventHandler delegado a un CollectionChanged evento .

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

Comentarios

Para obtener más información sobre el manejo de eventos, consulte controlar y provocar eventos.

Se aplica a