Source: http://www.bcmeng.com/windows-phone-touch1/
Please enter the content here (want to die, wrote for one hours, directly did not save accidentally deleted. Let's just say it. The pointer event has the following events:
- Pointercanceled
- Pointerentered
- PointerExited
- PointerMoved
- Pointerpressed
- Pointerreleased
- Pointercapturelost
The order of initiation is as follows:
When clicked: The Tap event raises the sequence of touch and pointer events as follows:
12:4:8-pointerentered event occurred
12:4:8-pointerpressed event occurred
12:4:8-manipulationstarting event occurred
12:4:8-pointermoved event occurred
12:4:8-pointermoved event occurred
12:4:8-pointerreleased event occurred
12:4:8-tapped event occurred
12:4:8-pointerexited event occurred
When long on time: The Righttap event raises the following touch and pointer events:
12:6:15-pointerentered event occurred
12:6:15-pointerpressed event occurred
12:6:15-manipulationstarting event occurred
12:6:15-pointermoved event occurred
12:6:15-pointermoved event occurred
12:6:16-pointerreleased event occurred
12:6:16-righttapped event occurred
12:6:16-pointerexited event occurred
On the meaning of each pointer event, we can also know according to the name, small dream just write very detailed, but no, everyone directly refer to the MSDN documentation. However, be aware that:
Each time a touch operation produces a pointerpressed event, the event is immediately after the pointerentered event, and all event data has the same information (same pointer ID, same location, and so on) for both events
The pointerpressed and pointerreleased events are not always paired up. Your application should listen to and handle actions that might draw a point (such as PointerExited,pointercanceled , and pointercapturelostanyway).
The following shows an instance of a stroke drawing implemented through pointer events and line controls:
First define a canvas:
<canvas name="Canvas" Background="Transparent" pointerpressed="canvas_pointerpressed" PointerMoved="canvas_pointermoved"></Canvas>
Background logic:
PrivatePoint Currentpoint;//latest, Current pointPrivatePoint Oldpoint;//Previous PointPrivate voidCanvas_pointerpressed (Objectsender, Pointerroutedeventargs e) {Currentpoint=e.getcurrentpoint (Canvas). Position;oldpoint=Currentpoint;}Private voidCanvas_pointermoved (Objectsender, Pointerroutedeventargs e) {Currentpoint=e.getcurrentpoint (Canvas). Position; Line Line=NewLine () {X1 = currentpoint.x, Y1 = currentpoint.y, X2 = oldpoint.x, Y2 =Oldpoint.y};line. Stroke=NewSolidColorBrush (colors.red); StrokeThickness=5; line. Strokelinejoin=Penlinejoin.round;line. StrokeStartLineCap=Penlinecap.round;line. Strokeendlinecap=Penlinecap.round; This. Canvas. Children.add (line); Oldpoint=Currentpoint;}
If you are not sure about the properties of line, please refer to Msdn:http://msdn.microsoft.com/library/windows/apps/system.windows.shapes.shape (v=vs.105). aspx
The results are as follows:
Windows Phone touch and pointer source code download, click I download Oh!
Windows Phone 8.1 development: Touch and pointer Events 2