Dragging Elements in Windows Store AppsThomas Claudius Huber
In Windows Store Apps there are three kinds of Touch-Events:
- Gesture Events – those are high-level-events like Tapped or RightTapped.
- Pointer-Events – low-level-events like PointerPressed, PointerMoved, PointerReleased.
- Manipulation-Events – low-level-events for multi-touch actions like rotate, scale or transform an element.
Pointer-Events consolidate Touch-, Pen- and Mouse-Input. So on the UIElement-class from WinRT you wont find Mouse-Events known from WPF/Silverlight like MouseLeftButtonDown.
In my upcoming Windows Store Apps I want to show how Elements can be dragged/moved with Pointer-Events. You can download the code of the sample here:
MovingElements, or in German ElementeVerschieben-Sample
The app looks like below. By touching an empty space in the yellow area, an Image is inserted. The image can be grabbed with a finger or with the mouse-cursor and moved around. The app works also with multiple fingers. You can grab multiple images at once and move them around.
If you´ve feedback to the code, feel free to comment.
As I´m really busy the next weeks/months with the writing of the Windows Store Apps-book, I´m not able to give you big support on the code. Use it or not.
Leave a Reply