This documentation is archived and is not being maintained.

GridColumnStylesCollection.Item Property (PropertyDescriptor)

Gets the DataGridColumnStyle associated with the specified PropertyDescriptor.

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

public DataGridColumnStyle this[
	PropertyDescriptor propertyDesciptor
] { get; }


Type: System.ComponentModel.PropertyDescriptor
The PropertyDescriptor associated with the DataGridColumnStyle.

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). _
End Sub 

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.