DataGridColumnStyle::MappingName Property
.NET Framework (current version)
Gets or sets the name of the data member to map the column style to.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The comparison used to match the MappingName to the data member is case-insensitive.
This DataGridColumnStyle is used to render the data in the indicated data member whenever the data source matches the one indicated by the MappingName property of the DataGridTableStyle that contains this column style.
The DataGridColumnStyle::MappingName property is usually set to the ColumnName of a DataColumn.
The following code example creates a DataGridTableStyle, and adds two DataGridColumnStyle objects to the GridColumnStylesCollection. The MappingName for each DataGridColumnStyle is set to the ColumnName of a DataColumn.
void AddDataGridTableStyle() { // Create a new DataGridTableStyle and set MappingName. DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; myGridStyle->MappingName = "Customers"; // Create two DataGridColumnStyle objects. DataGridColumnStyle^ colStyle1 = gcnew DataGridTextBoxColumn; colStyle1->MappingName = "firstName"; DataGridColumnStyle^ colStyle2 = gcnew DataGridBoolColumn; colStyle2->MappingName = "Current"; // Add column styles to table style. myGridStyle->GridColumnStyles->Add( colStyle1 ); myGridStyle->GridColumnStyles->Add( colStyle2 ); // Add the grid style to the GridStylesCollection. myDataGrid->TableStyles->Add( myGridStyle ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: