DataGridColumnStyle.PropertyDescriptorChanged Event


Occurs when the PropertyDescriptor property value changes.

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

Public Event PropertyDescriptorChanged As EventHandler

The following code example demonstrates the use of this member.

 Private Sub myButton_Click(ByVal sender As Object, ByVal e As EventArgs)
     If TablesAlreadyAdded Then
     End If
 End Sub 'myButton_Click

Private Sub AddCustomDataTableStyle()
   Dim myTableStyle As New DataGridTableStyle()
   ' Map DataGridTableStyle to a DataTable.
   myTableStyle.MappingName = "Orders"
   ' Get CurrencyManager object.
   Dim myCurrencyManager As CurrencyManager = CType(BindingContext(myDataSet, "Orders"), CurrencyManager)
   ' Use the CurrencyManager to get the PropertyDescriptor for column.
   Dim myPropertyDescriptor As PropertyDescriptor = myCurrencyManager.GetItemProperties()("Amount")
   ' Construct a 'DataGridColumnStyle' object changing its format to 'Currency'.
   Dim myColumnStyle As DataGridTextBoxColumn = New DataGridTextBoxColumn(myPropertyDescriptor, "c", True)
   ' Add EventHandler function for PropertyDescriptorChanged Event.
   AddHandler myColumnStyle.PropertyDescriptorChanged, AddressOf MyPropertyDescriptor_Changed
   ' Add the DataGridTableStyle instance to the GridTableStylesCollection.
   TablesAlreadyAdded = True
End Sub 'AddCustomDataTableStyle

 Private Sub MyPropertyDescriptor_Changed(ByVal sender As Object, ByVal e As EventArgs)
     myLabel.Text = "Property Descriptor Property of DataGridColumnStyle has changed"
 End Sub 'MyPropertyDescriptor_Changed

.NET Framework
Available since 1.1
Return to top