Gets elements by their location inside the grid.

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

Syntax

C#
public GridControl..::..GridHitTests HitTests { get; }
Visual Basic
Public ReadOnly Property HitTests As GridControl..::..GridHitTests
	Get
Visual C++
public:
property GridControl..::..GridHitTests^ HitTests {
	GridControl..::..GridHitTests^ get ();
}
F#
member HitTests : GridControl..::..GridHitTests with get

Property Value

Type: GridControl..::..GridHitTests

Remarks

The grid has a convenient system of getting elements by their location inside the grid. This is done with GridControl.HitTest() method that returns type of element in specified position. To get the element itself you can use one of GridControl.HitTests methods that return element pointers. We tried to create an API to avoid unnecessary type casting. An example of its use is provided below.
 Copy imageCopy
public void HitTestExample(GridControl grid)
{
    //Get the current cursor position
    Point position = Mouse.GetPosition(grid);

    //Get a part of the grid, the cursor points to.
    HitTestInfo info = grid.HitTest(position);

    //Try get a header, the cursor points to.
    Header header = grid.HitTests.HeaderTest(position);

    //Try get a row, the cursor points to.
    Row row = grid.HitTests.RowTest(position);

    //Try get a cell, the cursor points to.
    Cell cell = grid.HitTests.CellTest(position);

    //Try get a column, the cursor points to.
    Column column = grid.HitTests.ColumnTest(position);

    //Do something...
}

See Also