Invalidates the entire surface of the Header and causes it to be remeasured.

Namespace: Dapfor.Wpf.Controls
Assembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)

Syntax

C#
public void Invalidate()
Visual Basic
Public Sub Invalidate
Visual C++
public:
void Invalidate()
F#
member Invalidate : unit -> unit 

Remarks

GridControl provides very convenient API to remeasure different elements such as cells, rows, columns etc.

Below you may see a list of elements that can be remeasured 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() - Repainting of 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(GridControl 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 title 'Date' on the header2
    header2["Date"].Invalidate();

    //Invalidate all cells in the column 'Date'
    header2["Date"].InvalidateCells();
}

See Also