| Visual Basic (Declaration) | |
|---|---|
Public Property DisplayMemberBinding As BindingBase | |
| Visual Basic (Usage) | Copy Code |
|---|---|
| |
| C# | |
|---|---|
public BindingBase DisplayMemberBinding {get; set;} | |
Return Value
A reference to a BindingBase object representing the binding to apply to a data item in order to retrieve the values displayed by the column's cells.By default, a grid will automatically create a column for each property in the data item. In this case, columns that are manually added to a grid's Columns will be linked to any auto-generated columns which have the same field name. Any other column properties that have been explicitly set (e.g., Width) will override the values of the auto-generated columns.
If the grid's AutoCreateColumns property. is set to false (by default, true), the grid will not automatically create a column for each property in the data item. In this case, columns must be added manually to the grid's column collection and the DisplayMemberBinding property set to the BindingBase object that represents the binding to apply to the data item. The FieldName property must also be set in order to provide the column with a unique identifier and an ExceptionValidationRule added to the binding's ValidationRules property to properly handle any exceptions that might be raised.
When binding the grid to a DataGridCollectionView or DataGridCollectionViewSource (in XAML), it is recommended to use the ItemProperties property to add or remove the columns the will end up in the Columns collection and leave the AutoCreateColumns property to true.
Supported Frameworks: Microsoft .NET Framework version 3.0
Copy Code