TouchEventArgs.TouchDevice Property

Gets the touch that generated the event.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public TouchDevice TouchDevice { get; }

Property Value

Type: System.Windows.Input.TouchDevice
The touch that generated the event.

The following example handles the TouchUp events that occur on a Canvas. It checks the Captured property to verify that the device that raised the event is captured to the Canvas. If it is, the TouchDevice is released.

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);
    }
}

.NET Framework

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft