Repainting of all cells in the grid that are related to a certain column located on the same hierarchical level as a header.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public void InvalidateCells()
Visual Basic
Public Sub InvalidateCells
Visual C++
void InvalidateCells()
member InvalidateCells : unit -> unit 


It is well known that System.Windows.Forms controls use standard Windows API based on window messages. To repaint a certain part of a control, it should invoke the Control.Invalidate(Rectangle) method, where Rectangle specifies location and size of the client surface that should be repainted. In general, the calculation of screen coordinates of an element is a quite complicated process, especially in a hierarchical data grid. The .Net Grid provides very convenient API to repaint different elements such as cells, rows, columns etc.

Below you may see a list of elements that can be repainted in the grid:

  • Cell.Invalidate() - Repainting of a single cell.
  • Row.Invalidate() - Repainting of a single row.
  • Header.Invalidate() - Header invalidation. If the header is located in the hierarchical grid (not top-level header), all duplicates in visible surface are repainted.
  • Header.InvalidateRows() - Repaint all rows in the grid on the same hierarchical level as the header.
  • Column.Invalidate() - Column title invalidation.
  • Column.InvalidateCells() - Repainting of all cells in the grid that are related to a certain column located on the same hierarchical level as a header.
 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"));

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

    //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

    //Invalidate the cell

    //Invalidate the row

    //Invalidate the top-level header

    //Invalidate product1 and product2

    //Invalidate the column's caption 'Date' on the header2

    //Invalidate the cell 'Date' of each customer

See Also