System.Windows.Forms.DataGridTableStyle.MappingName Property

Gets or sets the name used to map this table to a specific data source.

Syntax

[System.ComponentModel.DefaultValue("")]
[System.ComponentModel.Editor("System.Windows.Forms.Design.DataGridTableStyleMappingNameEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
public string MappingName { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

To bind the System.Windows.Forms.DataGrid to a strongly typed array of objects, the object type must contain public properties. To create a System.Windows.Forms.DataGridTableStyle that displays the array, set the DataGridTableStyle.MappingName property to typename where typename is replaced by the name of the object type. Also note that the DataGridTableStyle.MappingName property is case-sensitive; the type name must be matched exactly. See the DataGridTableStyle.MappingName property for an example.

You can also bind the System.Windows.Forms.DataGrid to an ArrayList. A feature of the ArrayList is that it can contain objects of multiple types, but the System.Windows.Forms.DataGrid can only bind to such a list when all items in the list are of the same type as the first item. This means that all objects must either be of the same type, or they must inherit from the same class as the first item in the list. For example, if the first item in a list is a System.Windows.Forms.Control, the second item could be a System.Windows.Forms.TextBox (which inherits from System.Windows.Forms.Control). If, on the other hand, the first item is a System.Windows.Forms.TextBox, the second object cannot be a System.Windows.Forms.Control. Further, the ArrayList must have items in it when it is bound. An empty ArrayList will result in an empty grid. When binding to an ArrayList, set the DataGridTableStyle.MappingName of the System.Windows.Forms.DataGridTableStyle to "ArrayList" (the type name).

The default is the name of the list managed by the System.Windows.Forms.CurrencyManager for this grid. The System.Windows.Forms.CurrencyManager for the System.Windows.Forms.DataGridTableStyle is set using the DataGridTableStyle.#ctor constructor.

The DataGridTableStyle.MappingNameChanged event occurs when the DataGridTableStyle.MappingName value changes.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0