共用方式為


TouchEventArgs.TouchDevice 屬性

定義

取得產生事件的觸控。

public:
 property System::Windows::Input::TouchDevice ^ TouchDevice { System::Windows::Input::TouchDevice ^ get(); };
public System.Windows.Input.TouchDevice TouchDevice { get; }
member this.TouchDevice : System.Windows.Input.TouchDevice
Public ReadOnly Property TouchDevice As 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

適用於