The grid provides a huge variety of methods for repainting various grid elements. Please see the most typical example of this functionality below.

C# Copy imageCopy
public void InvalidateUiElements(Grid grid)
{
    //Add a new header on the top hierarchical level (level 0)
    Header header1 = new Header();
    header1.Add(new Column("Name"));
    header1.Add(new Column("Price"));
    header1.Add(new Column("Quantity"));
    grid.Headers.Add(header1);

    Header header2 = new Header();
    header2.Add(new Column("Name"));
    header2.Add(new Column("Date"));
    grid.Headers.Add(header2);


    //Add some data objects 
    Row product1 = grid.Rows.Add(new Product());
    Row product2 = grid.Rows.Add(new Product());

    //Add some customers to the first product
    Row customer1 = product1.Add(new Customer());
    Row customer2 = product1.Add(new Customer());

    //Add some customers to the another product
    Row customer3 = product2.Add(new Customer());

    //Expand all rows
    grid.Rows.ExpandAll();


    //Invalidate the cell
    customer1["Date"].Invalidate();

    //Invalidate the row
    customer1.Invalidate();

    //Invalidate the top-level header
    header1.Invalidate();

    //Invalidate product1 and product2
    header1.InvalidateRows();

    //Invalidate the column's caption 'Date' on the header2
    header2["Date"].Invalidate();

    //Invalidate the cell 'Date' of each customer
    header2["Date"].InvalidateCells();
}

Back to .Net Grid HowTo topics