Headers are important elements of the grid that define data presentation. They control data sorting, grouping and filtering and act as column containers. A grid may work with one or multiple headers. When there is only one header, the grid resembles Windows explorer behavior. Multiple headers enable you to control data on different hierarchy levels. You can set headers via designer, in programming code or via serialization. Please see below an example that shows creating headers and columns in the programming code.
C# | Copy |
---|---|
public void ConfigureGridHeaders(Grid grid) { //Add a new header on the top hierarchical level (level 0) grid.Headers.Add(new Header()); //Add a header on the 1st hierarchical level (level 1) and make it invisible grid.Headers.Add(new Header()); grid.Headers[1].Visible = false; //Create a column and add it to the top-level header Column column = new Column("time"); grid.Headers[0].Add(column); grid.Headers[0].Add(new Column("price")); //Set the label for column, identified by the 'time' identifier on the top hierarchical level grid.Headers[0]["time"].Name = "Time column"; //Move the column column.VisibleIndex = 1; } |
Back to .Net Grid HowTo topics