HitTestResult.VisualHit HitTestResult.VisualHit HitTestResult.VisualHit HitTestResult.VisualHit Property

Definición

Obtiene el objeto visual que se alcanzó.Gets the visual object that was hit.

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

Valor de propiedad

Valor DependencyObject que representa el objeto visual que se alcanzó.A DependencyObject value that represents the visual object that was hit.

Ejemplos

En el ejemplo siguiente se muestra cómo recuperar VisualHit el valor de propiedad en un método de devolución de llamada de la prueba de posicionamiento.The following example shows how to retrieve the VisualHit property value in a hit test 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

Comentarios

DependencyObjectes el tipo en lugar Visual de para que las pruebas de posicionamiento puedan enlazar árboles 2D y 3D a través de una ventanilla.DependencyObject is the type rather than Visual so that hit testing can bridge 2D and 3D trees through a viewport.

Se aplica a