15.4. Multitouch Functionality

Probably one of the most interesting features in WPF 4.0 is multitouch functionality. Multitouch allows your application to work with touch input and gestures (e.g., you can spin an image around by rotating your hand).

Multitouch support is Windows 7 only and is enabled by setting the IsManipulationEnabled property on an element to true and then handling the various events that the APIs expose. It's worth noting that multitouch functionality is compatible with Surface SDK 2.0 (the world's most expensive but cool table).

The ContentElement, UIElement, and UIElement3D elements support the following events:

  • PreviewTouchDown

  • TouchDown

  • PreviewTouchMove

  • TouchMove

  • PreviewTouchUp

  • TouchUp

  • GotTouchCapture

  • LostTouchCapture

  • TouchEnter

  • TouchLeave

Besides simple touch-related events, WPF 4.0 also supports various gestures. You can restrict the manipulations that can be performed in the ManipulationStarted event by specifying the ManipulationMode.

WPF 4.0 supports the following gesture-related events:

  • ManipulationStarted

  • ManipulationDelta

  • ManipulationInertiaStarting

  • ManipulationCompleted

  • ManipulationBoundaryFeedback

Currently, hardware support for multitouch is a bit limited and expensive (and who wants grubby fingerprints on their monitors?), but expect this to rapidly change in 2010.

Probably the best known multitouch devices are the Dell Latitude XT2 and HP Touchsmart. If you don't want to fork out for one of these devices, you could give the clever workaround with two mice here:

http://blog.wpfwonderland.com/2009/06/29/developing-win-7-multi-touch-apps-without-multi-touch-screen/.

MSDN has a good simple example demonstrating WPF's touch functionality at http://msdn.microsoft.com/en-us/library/ee649090(VS.100).aspx.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.237.176