TouchDevice.Captured Property

Definition

Ruft das Element ab, das das TouchDevice-Objekt erfasst hat.Gets the element that captured the TouchDevice.

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

Property Value

IInputElement

Das Element, das das TouchDevice-Objekt erfasst hat.The element that captured the TouchDevice.

Examples

Im folgenden Beispiel werden die TouchUp Ereignisse behandelt, die auf einem Canvasauftreten.The following example handles the TouchUp events that occur on a Canvas. Er überprüft die Captured-Eigenschaft, um zu überprüfen, ob das Gerät, das das Ereignis ausgelöst hat, in der Canvasaufgezeichnet wird.It checks the Captured property to verify that the device that raised the event is captured to the Canvas. Wenn dies der Fall ist, wird der TouchDevice freigegeben.If it is, the TouchDevice is released.

Dieses Beispiel ist Teil eines größeren Beispiels, das in der Übersicht über TouchDevice-Klasse verfügbar ist.This example is part of a larger example that is available in the TouchDevice class overview.

private void canvas_TouchUp(object sender, TouchEventArgs e)
{
    Canvas _canvas = (Canvas)sender as Canvas;
    if (_canvas != null && e.TouchDevice.Captured == _canvas)
    {
        _canvas.ReleaseTouchCapture(e.TouchDevice);
    }
}
' Touch Up
Private Sub canvas_TouchUp(ByVal sender As System.Object, ByVal e As System.Windows.Input.TouchEventArgs)
    Dim _canvas As Canvas = CType(sender, Canvas)
    If (_canvas IsNot Nothing AndAlso e.TouchDevice.Captured Is _canvas) Then
        _canvas.ReleaseTouchCapture(e.TouchDevice)

    End If
End Sub

Applies to