GridColumnStylesCollection::Item Property (PropertyDescriptor^)
Gets the DataGridColumnStyle associated with the specified PropertyDescriptor.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public: property DataGridColumnStyle^ default[ PropertyDescriptor^ propertyDesciptor ] { DataGridColumnStyle^ get(PropertyDescriptor^ propertyDesciptor); }
Parameters
- propertyDesciptor
-
Type:
System.ComponentModel::PropertyDescriptor^
The PropertyDescriptor associated with the DataGridColumnStyle.
Property Value
Type: System.Windows.Forms::DataGridColumnStyle^The DataGridColumnStyle associated the specified PropertyDescriptor.
Each DataGridColumnStyle is created using a PropertyDescriptor. The PropertyDescriptor can be returned using the PropertyDescriptor property.
To get the PropertyDescriptorCollection for a specific data source, use the GetItemProperties method of the BindingManagerBase class. Pass the MappingName to the Item property of the PropertyDescriptorCollection to return a PropertyDescriptor for a specific column.
The following code example gets a DataColumn from a DataTable in a DataSet, and then passes it as an argument to the Add method.
Private Sub ContainsThisDataCol() Dim myPropertyDescriptor As PropertyDescriptor Dim myPropertyDescriptorCollection As PropertyDescriptorCOllection myPropertyDescriptorCollection = _ me.BindingContext(DataSet1, "Customers").GetItemProperties() myPropertyDescriptor = myPropertyDescriptorCollection("FirstName") Dim myDataGridColumnStyle As DataGridColumnStyle myDataGridColumnStyle = DataGrid1.TableStyles(0). _ GridColumnStyles(myPropertyDescriptor) End Sub
Available since 1.1