Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend Touch


Touch has traditionally been approached as an input mechanism that is separate from the traditional mouse and keyboard. While some events such as a light tap may be “promoted” to appear like a mouse click to the host application, more complicated gestures like double taps, swipes, and pinches required quite a bit of work to integrate with an application. Our company wrote an open-source library called LightTouch (available online at http://lighttouch.codeplex.com/) just to deal with the nuances of touch in Silverlight applications.

With Windows 8 Metro applications, touch is first class and integrated across all devices. If you want to know if a user clicked, tapped, or touched a point on the screen with his stylus, you simply need to listen for the PointerPressed event. All sources of input are coalesced to the same event. You can also track the PointerMoved and even PointerReleased.

More specific interactions include Tapped and DoubleTapped, which can be triggered by clicks, taps, or stylus touches. The Holding event fires while the mouse button is pressed, the user’s finger is pressed against the display, or the stylus is engaged, while the RightTapped event fires based on a right-click or a tap that was held for a certain period of time. Again, all of these events allow you to focus on one interaction regardless of the method for input.

For multi-touch, a set of manipulation events are exposed. These allow you to process the array of touch points involved (i.e., multiple fingers) and how those points changed over time. For example, two points coming together or moving apart is a pinch and should impact the zoom level in your application, while two points rotating around a common center should result in a rotation manipulation if the current context supports that.

Developers will find it very easy to handle the appropriate touch events when developing Metro applications.

  • + Share This
  • 🔖 Save To Your Account