HitTestResult.VisualHit Propriété

Définition

Obtient l’objet visuel qui a été atteint.

public:
 property System::Windows::DependencyObject ^ VisualHit { System::Windows::DependencyObject ^ get(); };
public System.Windows.DependencyObject VisualHit { get; }
member this.VisualHit : System.Windows.DependencyObject
Public ReadOnly Property VisualHit As DependencyObject

Valeur de propriété

DependencyObject

Retourne une valeur DependencyObject qui représente l’objet visuel qui a été atteint.

Exemples

L’exemple suivant montre comment récupérer la valeur de propriété VisualHit dans une méthode de rappel de test d’accès.

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

Remarques

DependencyObject est le type plutôt que Visual pour que les tests d’accès puissent ponter les arbres 2D et 3D par le biais d’une fenêtre d’affichage.

S’applique à