GridColumnStylesCollection::CollectionChanged Event

 

Occurs when a change is made to the GridColumnStylesCollection.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
event CollectionChangeEventHandler^ CollectionChanged {
	void add(CollectionChangeEventHandler^ value);
	void remove(CollectionChangeEventHandler^ value);
}

For more information about handling events, see NIB: Consuming Events.

The following code example adds a handler for the CollectionChanged event.

private:
   void AddHandler()
   {
      GridColumnStylesCollection^ myGridColumns;
      myGridColumns = dataGrid1->TableStyles[ 0 ]->GridColumnStyles;

      // Add the handler.
      myGridColumns->CollectionChanged += gcnew CollectionChangeEventHandler( this, &Form1::GridCollection_Changed );
   }

   void GridCollection_Changed( Object^ sender, CollectionChangeEventArgs^ /*e*/ )
   {
      GridColumnStylesCollection^ myGridColumns;
      myGridColumns = dynamic_cast<GridColumnStylesCollection^>(sender);
      Console::WriteLine( myGridColumns->Count );
   }

.NET Framework
Available since 1.1
Return to top
Show: