PointHitTestParameters.HitPoint Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the Point against which to hit test.

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

public Point HitPoint { get; }

Property Value

Type: System.Windows.Point

The Point against which to hit test.

The following example shows how to override default hit test support in a user-defined visual object. In this case, the HitPoint value is simply returned as part of PointHitTestResult.

// Override default hit test support in visual object.
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
{
    Point pt = hitTestParameters.HitPoint;

    // Perform custom actions during the hit test processing,
    // which may include verifying that the point actually
    // falls within the rendered content of the visual.

    // Return hit on bounding rectangle of visual object.
    return new PointHitTestResult(this, pt);
}

.NET Framework
Available since 3.0
Return to top
Show: