Represents a single touch input produced by a finger on a touchscreen.
Assembly: PresentationCore (in PresentationCore.dll)
Called from constructors in derived classes to initialize theclass.
Gets the element that captured the.
Gets the capture policy of the.
Gets the element that the touch contact point is directly over.
Gets the unique identifier of the, as provided by the operating system.
Gets a value that indicates whether the device is active.
Gets the element that receives input from the InputDevice::Target.).(Overrides
Adds theto the input messaging system.
Captures a touch to the specified element by using the Element capture mode.
Captures a touch to the specified element by using the specified CaptureMode.
Removes thefrom the input messaging system.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
When overridden in a derived class, returns all touch points that are collected between the most recent and previous touch events.
Returns the current position of the touch device relative to the specified element.
Called when a touch is captured to an element.
Called when a manipulation has ended.
Called when a manipulation is started.
Reports that a touch is pressed on an element.
Reports that a touch is moving across an element.
Reports that a touch was lifted from an element.
Sets the PresentationSource that is reporting input for this device.
Forces theto synchronize the user interface with underlying touch points.
Returns a string that represents the current object.(Inherited from Object.)
The following example enables you to create simple patterns on a Canvas by dragging two fingers on a touchscreen. Each touch is represented by a in the TouchEventArgs. The pattern is created by drawing a line between the touch points that are provided by the touches. This example requires a Windows Touch–compatible screen.
The following markup creates the user interface, which consists of a Canvas that is centered in a grid, and attaches the event handlers for the touch events.
<Window x:Class="WpfTouchEventsSample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="525" Width="525"> <Grid> <Canvas x:Name="canvas1" Width="500" Height="500" Background="Black" TouchDown="canvas_TouchDown" TouchMove="canvas_TouchMove" TouchUp="canvas_TouchUp" /> </Grid> </Window>
The following code handles the touch events. When a touch is pressed on the Canvas, the is captured to the Canvas. When the touch is lifted, the is released. When a touch moves on the Canvas, the Id is checked. If the move came from the first touch, its location is recorded. If the move came from the second touch, a line is drawn from the position of the first touch to the position of the second touch.
Available since 4.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.