Version

We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. 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