HitTestResultBehavior 枚举

定义

确定在命中测试期间是否继续任何剩余可见对象的枚举。Determines whether to continue the enumeration of any remaining visual objects during a hit test.

public enum class HitTestResultBehavior
public enum HitTestResultBehavior
type HitTestResultBehavior = 
Public Enum HitTestResultBehavior
继承
HitTestResultBehavior

字段

Continue 1

继续对可视化树层次结构中的下一个可见对象进行命中测试。Continue hit testing against the next visual in the visual tree hierarchy.

Stop 0

停止任何进一步的命中测试,并从该回调返回。Stop any further hit testing and return from the callback.

示例

下面的示例演示如何从命中测试HitTestResultBehavior结果回调方法返回值。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;
}
' Return the result of the hit test to the callback.
Public Function MyHitTestResult(ByVal result As HitTestResult) As HitTestResultBehavior
    ' 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
End Function

注解

命中测试结果回调方法定义在可视化树中的特定可视对象上标识命中测试时执行的操作。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. 执行这些操作后, 将返回一个HitTestResultBehavior值, 该值确定是否继续枚举任何其他视觉对象。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. 通过在Continue你的命中测试回叫方法中返回, 你可以标识命中的所有视觉对象, 甚至可以标识其他视觉对象可能部分或全部覆盖的视觉对象。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.

适用于

另请参阅