This documentation is archived and is not being maintained.

PointHitTestResult.VisualHit Property

Gets the visual object that is returned from a hit test result.

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

public Visual VisualHit { get; }

Property Value

Type: System.Windows.Media.Visual
A Visual object that represents the hit test result.

The VisualHit value could potentially represent multiple visual objects during a single hit test. The hit test callback method defines the actions you perform when a hit test is identified on a particular visual object in the visual tree. After you perform the actions, you return a HitTestResultBehavior value that determines whether to continue the enumeration of any other visual objects. The order of enumeration of returned visual objects is by z-order on the rendering plane.

The following example shows how to access the VisualHit property in a hit test results callback function.

// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResult(HitTestResult result)
    // Add the hit test result to the list that will be processed after the enumeration.

    // Set the behavior to return visuals at all z-order levels.
    return HitTestResultBehavior.Continue;

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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