GeometryHitTestResult.IntersectionDetail Property

Gets the IntersectionDetail value of the hit test.

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

public IntersectionDetail IntersectionDetail { get; }

Property Value

Type: System.Windows.Media.IntersectionDetail
The IntersectionDetail value of the hit test.

The IntersectionDetail property describes the intersection between a Geometry and the target visual object.

The following illustration shows the relationship between the hit test geometry (the blue circle) and the target object (the red square).

The intersection between a hit test geometry and a target object

Diagram of IntersectionDetail used in hit testing

The following example shows how to use the IntersectionDetail property of GeometryHitTestResult.

// Return the result of the hit test to the callback. 
public HitTestResultBehavior MyHitTestResultCallback(HitTestResult result)
{
    // Retrieve the results of the hit test.
    IntersectionDetail intersectionDetail = ((GeometryHitTestResult)result).IntersectionDetail;

    switch (intersectionDetail)
    {
        case IntersectionDetail.FullyContains:

            // Add the hit test result to the list that will be processed after the enumeration.
            hitResultsList.Add(result.VisualHit);

            return HitTestResultBehavior.Continue;

        case IntersectionDetail.Intersects:

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

        case IntersectionDetail.FullyInside:

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

        default:
            return HitTestResultBehavior.Stop;
    }
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft