GeometryHitTestResult.VisualHit GeometryHitTestResult.VisualHit GeometryHitTestResult.VisualHit GeometryHitTestResult.VisualHit Property

Definición

Obtiene el objeto visual que se devuelve de un resultado de prueba de posicionamiento.Gets the visual object that is returned from a hit test result.

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

Valor de propiedad

Objeto Visual que representa el resultado de la prueba de posicionamiento.A Visual object that represents the hit test result.

Ejemplos

El ejemplo siguiente muestra cómo hacer referencia al valor de la VisualHit propiedad en un procedimiento de devolución de llamada de prueba de posicionamiento.The following example shows how to reference the value of the VisualHit property in a hit test callback procedure.

// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResultCallback(HitTestResult result)
{
    // Retrieve the results of the hit test.
    IntersectionDetail intersectionDetail = ((GeometryHitTestResult)result).IntersectionDetail;

    switch (intersectionDetail)
    {
        case IntersectionDetail.FullyContains:

            // Add the hit test result to the list that will be processed after the enumeration.
            hitResultsList.Add(result.VisualHit);

            return HitTestResultBehavior.Continue;

        case IntersectionDetail.Intersects:

            // Set the behavior to return visuals at all z-order levels.
            return HitTestResultBehavior.Continue;

        case IntersectionDetail.FullyInside:

            // Set the behavior to return visuals at all z-order levels.
            return HitTestResultBehavior.Continue;

        default:
            return HitTestResultBehavior.Stop;
    }
}
' Return the result of the hit test to the callback.
Public Function MyHitTestResultCallback(ByVal result As HitTestResult) As HitTestResultBehavior
	' Retrieve the results of the hit test.
	Dim intersectionDetail As IntersectionDetail = (CType(result, GeometryHitTestResult)).IntersectionDetail

	Select Case intersectionDetail
		Case IntersectionDetail.FullyContains

			' Add the hit test result to the list that will be processed after the enumeration.
			hitResultsList.Add(result.VisualHit)

			Return HitTestResultBehavior.Continue

		Case IntersectionDetail.Intersects

			' Set the behavior to return visuals at all z-order levels.
			Return HitTestResultBehavior.Continue

		Case IntersectionDetail.FullyInside

			' Set the behavior to return visuals at all z-order levels.
			Return HitTestResultBehavior.Continue

		Case Else
			Return HitTestResultBehavior.Stop
	End Select
End Function

Se aplica a