-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Touch.xml
97 lines (78 loc) · 8.66 KB
/
Touch.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<Type Name="Touch" FullName="System.Windows.Input.Touch">
<TypeSignature Language="C#" Value="public static class Touch" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit Touch extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Windows.Input.Touch" />
<TypeSignature Language="VB.NET" Value="Public Class Touch" />
<TypeSignature Language="F#" Value="type Touch = class" />
<TypeSignature Language="C++ CLI" Value="public ref class Touch abstract sealed" />
<AssemblyInfo>
<AssemblyName>PresentationCore</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides an application-level service that processes multitouch input from the operating system and raises the <see cref="E:System.Windows.Input.Touch.FrameReported" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Input.Touch.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 <xref:System.Windows.UIElement.TouchDown> and <xref:System.Windows.UIElement.TouchMove>, on <xref:System.Windows.UIElement>, <xref:System.Windows.UIElement3D>, or <xref:System.Windows.ContentElement>.
The <xref:System.Windows.Input.Touch.FrameReported> event does not use the same event model as other WPF input events, such as <xref:System.Windows.UIElement.TouchDown> and <xref:System.Windows.UIElement.TouchMove>. Instead of being exposed as an element-specific event that potentially routes through the object tree of a UI, the <xref:System.Windows.Input.Touch.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 <xref:System.Windows.Input.TouchFrameEventArgs> to get the <xref:System.Windows.Input.TouchPoint> values that are relevant to the touch event. From the <xref:System.Windows.Input.TouchPoint>, you can get the <xref:System.Windows.Input.TouchPoint.Position%2A> of the touch and determine whether the <xref:System.Windows.Input.TouchAction> was a <xref:System.Windows.Input.TouchAction.Down>, <xref:System.Windows.Input.TouchAction.Move>, or <xref:System.Windows.Input.TouchAction.Up> action. You can also use the <xref:System.Windows.Input.TouchPoint> to get the <xref:System.Windows.Input.TouchDevice>. From the <xref:System.Windows.Input.TouchDevice>, you can determine the device <xref:System.Windows.Input.TouchDevice.Id%2A> and get information about the element that is touched.
## Examples
The following example enables you to create simple patterns on a <xref:System.Windows.Controls.Canvas> by dragging two fingers across a touchscreen. Each touch is represented by a <xref:System.Windows.Input.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.
The following markup creates the user interface, which consists of a <xref:System.Windows.Controls.Canvas> that is centered in a <xref:System.Windows.Controls.Grid>.
:::code language="xaml" source="~/snippets/csharp/System.Windows.Input/Touch/Overview/mainwindow.xaml" id="Snippet000":::
The following code handles the <xref:System.Windows.Input.Touch.FrameReported> event. When a touch presses on the <xref:System.Windows.Controls.Canvas>, the <xref:System.Windows.Input.TouchDevice> is captured to the <xref:System.Windows.Controls.Canvas>. When the touch is lifted, the <xref:System.Windows.Input.TouchDevice> is released. When a touch moves across the <xref:System.Windows.Controls.Canvas>, the <xref:System.Windows.Input.TouchDevice.Id%2A> 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.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Input/Touch/Overview/mainwindow.xaml.cs" id="Snippet100":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/touchframesample/vb/mainwindow.xaml.vb" id="Snippet100":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName="FrameReported">
<MemberSignature Language="C#" Value="public static event System.Windows.Input.TouchFrameEventHandler FrameReported;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Input.TouchFrameEventHandler FrameReported" />
<MemberSignature Language="DocId" Value="E:System.Windows.Input.Touch.FrameReported" />
<MemberSignature Language="VB.NET" Value="Public Shared Custom Event FrameReported As TouchFrameEventHandler " FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.FrameReported : System.Windows.Input.TouchFrameEventHandler " Usage="member this.FrameReported : System.Windows.Input.TouchFrameEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 static event System::Windows::Input::TouchFrameEventHandler ^ FrameReported;" />
<MemberSignature Language="VB.NET" Value="Public Shared Event FrameReported As TouchFrameEventHandler " FrameworkAlternate="netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationCore</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Input.TouchFrameEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when a touch message is sent.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A frame is one in a series of multitouch messages or touch points. You can respond to touches by handling the <xref:System.Windows.Input.Touch.FrameReported> event and accessing the details of the <xref:System.Windows.Input.TouchPoint> from the <xref:System.Windows.Input.TouchFrameEventArgs> event data.
The <xref:System.Windows.Input.Touch.FrameReported> event does not use the same event model as other WPF input events, such as <xref:System.Windows.UIElement.TouchDown> and <xref:System.Windows.UIElement.TouchMove>. Instead of being exposed as an element-specific event that potentially routes through the object tree of a UI, the <xref:System.Windows.Input.Touch.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.
## Examples
The following example handles the <xref:System.Windows.Input.Touch.FrameReported> event. When a touch presses on the <xref:System.Windows.Controls.Canvas>, the <xref:System.Windows.Input.TouchDevice> is captured to the <xref:System.Windows.Controls.Canvas>. When the touch is lifted, the <xref:System.Windows.Input.TouchDevice> is released. When a touch moves across the <xref:System.Windows.Controls.Canvas>, the <xref:System.Windows.Input.TouchDevice.Id%2A> 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.
This example is part of a larger example that is available in the <xref:System.Windows.Input.Touch> class overview.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Input/Touch/Overview/mainwindow.xaml.cs" id="Snippet110":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/touchframesample/vb/mainwindow.xaml.vb" id="Snippet110":::
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>