HitTestResultBehavior 列舉

定義

判斷在點擊測試期間是否繼續列舉任何剩餘的視覺物件。

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

欄位

Continue 1

繼續對視覺化樹狀結構階層架構中的下一個視覺物件進行點擊測試。

Stop 0

停止任何進一步的點擊測試,並從回呼返回。

範例

下列範例示範如何從點擊測試結果回呼方法傳回 HitTestResultBehavior 值。

// 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

備註

點擊測試結果回呼方法會定義您在視覺化樹狀結構中特定視覺物件上識別點擊測試時所執行的動作。 執行動作之後,您會傳回值 HitTestResultBehavior ,判斷是否要繼續列舉任何其他視覺物件。

視覺化樹狀結構中的幾何只要包含指定座標值,您就可以列舉所有視覺物件。 藉由在點擊測試回呼方法中傳 Continue 回,您可以識別所有叫用的視覺物件,甚至是其他視覺物件可能部分或完全遮蔽的視覺物件。

適用於

另請參閱