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

属性值

生成事件的触摸设备。

示例

以下示例处理 TouchUp 在 上 Canvas发生的事件。 它检查 属性以 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

适用于