[]
        
(Showing Draft Content)

C1.WPF.FlexGrid.C1FlexGrid.HitTest

HitTest Method

HitTest(RoutedEventArgs)

Gets a HitTestInfo object that contains information about the grid at a given location.

Declaration
public HitTestInfo HitTest(RoutedEventArgs e)
Parameters
Type Name Description
RoutedEventArgs e

MouseEventArgs that specifies the point to be tested.

Returns
Type Description
HitTestInfo

A HitTestInfo object that contains information about the grid at the location specified by the e parameter.

Examples

The code below handles the MouseMove event and shows the coordinates and content of the cell under the mouse.

void _flex_MouseMove(object sender, MouseEventArgs e)
{
    var ht = _flex.HitTest(e);
    _tb.Text = string.Format(
        "HitTest:: cell type {0}, row {1}, column {2}, content '{3}'", 
        ht.CellType, // e.g. Cell, ColumnHeader, RowHeader
        ht.Row, 
        ht.Column, 
        ht.CellRange.IsValid ? _flex[ht.Row, ht.Column] : "n/a");
}

HitTest(Point)

Gets a HitTestInfo object that contains information about the grid at a given location.

Declaration
public HitTestInfo HitTest(Point point)
Parameters
Type Name Description
Point point
<xref href="System.Windows.Point" data-throw-if-not-resolved="false"></xref>, in control coordinates, that specifies

the position to be tested.

Returns
Type Description
HitTestInfo

A HitTestInfo object that contains information about the grid at the location specified by the point parameter.

Remarks

For more details and an example, please see HitTest(MouseEventArgs).