Provides an application-level service that processes multitouch input from the operating system and raises the FrameReported event.
Assembly: PresentationCore (in PresentationCore.dll)
Thetype exposes the following members.
The FrameReported event is included in Windows Presentation Foundation (WPF) to support compatibility with Silverlight. If you do not have to ensure compatibility with Silverlight, use the touch events, such as TouchDown and TouchMove, on UIElement, UIElement3D, or ContentElement.
The FrameReported event does not use the same event model as other WPF input events, such as TouchDown and TouchMove. Instead of being exposed as an element-specific event that potentially routes through the object tree of a UI, the FrameReported event is a single event that is handled at the application level. Therefore, you cannot use the sender parameter of the event handler to determine what element is touched.
Use the TouchFrameEventArgs to get the TouchPoint values that are relevant to the touch event. From the TouchPoint, you can get the Position of the touch and determine whether the TouchAction was a Down, Move, or Up action. You can also use the TouchPoint to get the TouchDevice. From the TouchDevice, you can determine the device Id and get information about the element that is touched.
The following example enables you to create simple patterns on a Canvas by dragging two fingers across a touchscreen. Each touch is represented by a TouchDevice.The pattern is created by drawing a line between the touch points provided by the touches. This example requires a Windows Touch–compatible screen.
<Window x:Class="WpfTouchFrameSample.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" /> </Grid> </Window>
The following code handles the FrameReported event. When a touch presses on the Canvas, the TouchDevice is captured to the Canvas. When the touch is lifted, the TouchDevice is released. When a touch moves across 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.