Version

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

Change Column Type Mapping

The xamGrid™ control generates columns automatically based on the data types exposed by your data items. You can change the type of columns that xamGrid generates by changing its column type mapping. In order to change the column type mappings, you have to define a ColumnTypeMapping object and set its ColumnType and DataType properties. When xamGrid encounters the specified data type in your data source, it will generate the corresponding type of column.

The following code shows you how to set xamGrid’s column mapping to generate a text column for fields with Boolean data types. Notice the cells in the Discontinued column display data as text.

In XAML:

xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ig="http://schemas.infragistics.com/xaml"

<ig:XamGrid.ColumnTypeMappings>
    <ig:ColumnTypeMapping ColumnType="ig:TextColumn" DataType="sys:Boolean" />
</ig:XamGrid.ColumnTypeMappings>

In Visual Basic:

Dim mapping1 As New ColumnTypeMapping()
mapping1.ColumnType = GetType(TextColumn)
mapping1.DataType = GetType(Boolean)
Me.xamGrid1.ColumnTypeMappings.Add(mapping1)

In C#:

ColumnTypeMapping mapping1 = new ColumnTypeMapping();
mapping1.ColumnType = typeof(TextColumn);
mapping1.DataType = typeof(Boolean);
this.xamGrid1.ColumnTypeMappings.Add(mapping1);
sl xamGrid change Column Type Mapping 01.png