HitTestResultBehavior 列挙型

定義

ヒット テスト中に残りのビジュアル オブジェクトの列挙を続行するかどうかを決定します。

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

フィールド

名前 説明
Stop 0

それ以上ヒット テストを停止し、コールバックから戻ります。

Continue 1

ビジュアル ツリー階層内の次のビジュアルに対するヒット テストを続行します。

次の例は、ヒット テストの結果コールバック メソッドから 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 を返すことで、ヒットしたすべてのビジュアル オブジェクト (他のビジュアル オブジェクトによって部分的または完全に隠れている可能性があるビジュアル オブジェクトも含む) を識別できます。

適用対象

こちらもご覧ください