Export (0) Print
Expand All
Expand Minimize

HitTestResultBehavior Enumeration

Determines whether to continue the enumeration of any other visual objects during a hit test.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public enum HitTestResultBehavior
public enum HitTestResultBehavior
public enum HitTestResultBehavior
<object property="EnumerationValue" .../>

 Member nameDescription
ContinueContinue hit testing against the next visual in the visual tree hierarchy. 
StopStop any further hit testing and return. 

A hit test results callback method defines the actions that 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.

You can enumerate all visual objects in a visual tree whose geometry contains a specified coordinate value. By returning Continue in your hit test callback method, you can identify all visual objects that are hit, even those that may be partly or wholly obscured by other visual objects.

The following example shows how to return a HitTestResultBehavior value from a hit test results callback method.

// 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.
    hitResultsList.Add(result.VisualHit);

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft