共用方式為


TouchDevice.Captured 屬性

定義

取得擷取到 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

屬性值

擷取到 TouchDevice 的項目。

範例

下列範例會處理 TouchUpCanvas發生的事件。 它會檢查 Captured 屬性,以確認引發事件的裝置已擷取至 Canvas。 如果是,則會 TouchDevice 釋出 。

這個範例是類別概觀中可用的較大範例的 TouchDevice 一部分。

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

適用於