Q. I use a grid with one header where rows can contain child rows. Is it possible to sort just the top level rows without a second header?

A. You can dock newly added rows to the top of their parent. Docked rows are simple data rows that can be docked on top or bottom at any hierarchical level. Such rows don’t depend on data sorting direction and constantly stay on their fixed positions. In programming, docking is accessible via Row.Dock property. You may specify multiple docked rows. If your grid already has docked rows, the next docked row will be placed after the previously docked row and the first non-docked row. Docked rows can also be filtered or grouped as any other data rows.

C# Copy imageCopy
Row parentRow = ...;

Row childRow = parentRow.Add(your object);
//Dock row to the top
childRow.Dock = RowDockStyle.Top;

Back to .Net Grid HowTo topics