DataGridColumnStyle.MappingName DataGridColumnStyle.MappingName DataGridColumnStyle.MappingName DataGridColumnStyle.MappingName Property

Definition

Ruft den Namen des Datenmembers fest, dem das Spaltenformat zugeordnet werden soll, oder legt diesen fest.Gets or sets the name of the data member to map the column style to.

public:
 property System::String ^ MappingName { System::String ^ get(); void set(System::String ^ value); };
public string MappingName { get; set; }
member this.MappingName : string with get, set
Public Property MappingName As String

Eigenschaftswert

Der Name des Datenmembers, dem das Spaltenformat zugeordnet werden soll.The name of the data member to map the column style to.

Beispiele

Im folgenden Codebeispiel wird ein DataGridTableStyleerstellt, und es DataGridColumnStyle werden zwei- GridColumnStylesCollectionObjekte hinzugefügt.The following code example creates a DataGridTableStyle, and adds two DataGridColumnStyle objects to the GridColumnStylesCollection. Der MappingName for each DataGridColumnStyle -Wert wird auf ColumnName den eines DataColumnfestgelegt.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 );
}
private void AddDataGridTableStyle()
{
   // Create a new DataGridTableStyle and set MappingName.
   DataGridTableStyle myGridStyle = 
   new DataGridTableStyle();
   myGridStyle.MappingName = "Customers";

   // Create two DataGridColumnStyle objects.
   DataGridColumnStyle colStyle1 =
   new DataGridTextBoxColumn();
   colStyle1.MappingName = "firstName";
   
   DataGridColumnStyle colStyle2 =
   new 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);
}
Private Sub AddDataGridTableStyle()
   ' Create a new DataGridTableStyle and set MappingName.
   Dim myGridStyle As DataGridTableStyle = _
   new DataGridTableStyle()
   myGridStyle.MappingName = "Customers"

   ' Add two DataGridColumnStyle objects.
   Dim colStyle1 As DataGridColumnStyle = _
   new DataGridTextBoxColumn()
   colStyle1.MappingName = "firstName"
   
   Dim colStyle2 As DataGridColumnStyle = _
   new 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)
End Sub

Hinweise

Bei dem Vergleich, mit dem MappingName dem Datenmember abgeglichen wird, wird die Groß-/Kleinschreibung beachtet.The comparison used to match the MappingName to the data member is case-insensitive.

Wird verwendet, um die Daten im angegebener Datenmember zu erzeugen, wenn die Datenquelle mit der überein MappingName stimmt, die DataGridTableStyle von der-Eigenschaft des-Objekts angegeben wird, das diesen Spalten Stil enthält. DataGridColumnStyleThis 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.

Die DataGridColumnStyle.MappingName -Eigenschaft wird normalerweise auf ColumnName die eines DataColumnfestgelegt.The DataGridColumnStyle.MappingName property is usually set to the ColumnName of a DataColumn.

Gilt für: