HitTest
Suppose I have a grid with a two level hierarchy and set a DoubleClick event handler as follows:
public void DoubleClickHandler(object sender, EventArgs e)
{
Point point = PointToClient(Cursor.Position);
Header header = this.HitTests.HeaderTest(point);
// Suppose header here is a lower level header. How do I get a reference to the container Row associated with this header here?
}
Regards,
0
-
Hello,
Below you will find a code for your example:public void DoubleClickHandler(object sender, EventArgs e)
{
Point point = grid.PointToClient(Cursor.Position);
Header header = grid.HitTests.HeaderTest(point);
Rectangle headerBounds = grid.HitTests.HeaderVisibleBoundsTest(point);
if(header != null)
{
//Get a first row below the header
Row row = grid.HitTests.RowTest(new Point(point.X, headerBounds.Bottom));
if (row != null && row.Header == header && row.Parent != null)
{
foreach(Row child in row.Parent.Children)
{
}
}
}
}
Best regards,
Dapfor0
Please sign in to leave a comment.
Comments
1 comment