PointHitTestParameters Constructor

Initializes a new instance of the PointHitTestParameters class, using a Point.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public PointHitTestParameters(
	Point point
)

Parameters

point
Type: System.Windows.Point

The parameter that is specified as the Point value.

The following example shows how to invoke HitTest by using a PointHitTestParameters value.

// Respond to the right mouse button down event by setting up a hit test results callback. 
private void OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
    // Retrieve the coordinate of the mouse position.
    Point pt = e.GetPosition((UIElement)sender);

    // Clear the contents of the list used for hit test results.
    hitResultsList.Clear();

    // Set up a callback to receive the hit test result enumeration.
    VisualTreeHelper.HitTest(myCanvas, null,
        new HitTestResultCallback(MyHitTestResult),
        new PointHitTestParameters(pt));

    // Perform actions on the hit test results list. 
    if (hitResultsList.Count > 0)
    {
        Console.WriteLine("Number of Visuals Hit: " + hitResultsList.Count);
    }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft