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.
Setting Fixed Columns Programmatically
Your end users can pin or unpin columns on xamGrid™ by either dragging the column to a drop location or using the indicator in the column’s header (depending on your settings, for more information see the Enable Fixed Columns topic).
However, you can also set programmatically fixed columns to be displayed to your end user.
There are two collections for fixed columns:
To fix columns, you simply add the required columns to the fixed columns collection. You can also unpin a column by removing it from the fixed columns collection.
The following code demonstrates how to achieve this.
Imports Infragistics.Controls.Grids
...
'Add a column to the left-hand side fixed column collection
Dim DisplayAsFixedColumn As Column = Me.MyGrid.Columns.DataColumns("ProductName")
Me.MyGrid.FixedColumnSettings.FixedColumnsLeft.Add(DisplayAsFixedColumn)
'Remove a column from the left-hand side fixed column collection
Me.MyGrid.FixedColumnSettings.FixedColumnsLeft.Remove(DisplayAsFixedColumn)
using Infragistics.Controls.Grids;
...
//Add a column to the left-hand side fixed column collection
Column DisplayAsFixedColumn = this.MyGrid.Columns.DataColumns["ProductName"];
this.MyGrid.FixedColumnSettings.FixedColumnsLeft.Add(DisplayAsFixedColumn);
//Remove a column from the left-hand side fixed column collection
this.MyGrid.FixedColumnSettings.FixedColumnsLeft.Remove(DisplayAsFixedColumn);
You can use the IsFixable property to set fixed columns. The IsFixable property of the Column object determines if the column is fixed.
The following code demonstrates how to fix a column using the IsFixable property.
<ig:TextColumn Key="ProductID" IsFixable="True"/>
Imports Infragistics.Controls.Grids
...
Dim ColumnNotFixable As Column = Me.MyGrid.Columns.DataColumns("ProductID")
ColumnNotFixable.IsFixable = True
using Infragistics.Controls.Grids;
...
Column ColumnNotFixable = this.MyGrid.Columns.DataColumns["ProductID"];
ColumnNotFixable.IsFixable = true;