This documentation is archived and is not being maintained.

PointHitTestResult Class

Represents the results of a hit test that uses a Point as a hit test parameter.

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

public ref class PointHitTestResult : public HitTestResult
You cannot directly create an instance of this class in XAML.

You can also perform a hit test on a visual object by using a Geometry as a hit test parameter and returning the result as a GeometryHitTestResult. For more information, see How to: Hit Test Using Geometry as a Parameter.

The following example shows how to retrieve the PointHitTestResult return value from the HitTest method.

// Respond to the left mouse button down event by initiating the hit test. 
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    // Retrieve the coordinate of the mouse position.
    Point pt = e.GetPosition((UIElement)sender);

    // Perform the hit test against a given portion of the visual object tree.
    HitTestResult result = VisualTreeHelper.HitTest(myCanvas, pt);

    if (result != null)
        // Perform action on hit visual object.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0