Home Forums WinForms controls Xceed Grid for WinForms Combine hidden and multiple fixed columns Reply To: Combine hidden and multiple fixed columns

User (Old forums)
Member
Post count: 23064

I find this very confusing. You’re trying to freeze a column in the middle of the grid? So when the user scrolls horizontally, the same column stays in the middle?
I may find a way to do this, but the problem will be this: because the columns can have different widths, the frozen middle column will jump around when scrolling horizontally.

You can freeze a column so it’s always the first visible column (left), like this:

Xceed.Grid.Column fixedColumn = grid.Columns[“id”]; // ‘id’ is the fixed first visible column
grid.FirstVisibleColumnChanged += new EventHandler(gridFVCChanged);
private void gridFVCChanged(object sender, EventArgs e)
{
if (fixedColumn == null) return;
Xceed.Grid.Column col = grid.FirstVisibleColumn;
if (col != null && col != fixedColumn) fixedColumn.VisibleIndex = col.VisibleIndex;
}

Imported from legacy forums. Posted by Tommy (had 210 views)