Fixed columns are always visible and are not engaged in horizontal sorting. To freeze a column, use Header.FixedColumns.Count to set the desired number of constantly displayed unscrollable columns.

C# Copy imageCopy
public void FixedColumnsExample(Grid grid)
    //Add a new header on the top hierarchical level (level 0)
    Header header = new Header();
    header.Add(new Column("Column1"));
    header.Add(new Column("Column2"));
    header.Add(new Column("Column3"));

    Console.WriteLine("Fixed columns count: {0}", header.FixedColumns.Count);

    //Set the number of non-scrollable columns
    header.FixedColumns.Count = 2;

    foreach (Column column in header.FixedColumns)
        Console.WriteLine("Fixed column: id = '{0}'", column.Id);

    //All columns in the grid will be scrollable
    Console.WriteLine("Fixed columns count: {0}", header.FixedColumns.Count);
    Console.WriteLine("Columns count: {0}", header.Count);

//Fixed columns count: 0
//Fixed column: id = 'Column1'
//Fixed column: id = 'Column2'
//Fixed columns count: 0
//Columns count: 3

Back to .Net Grid HowTo topics