Chapter 10. Supporting Multi-Touch

This lesson describes the purpose and use of Windows Phone 7 multi-touch behavior. Multi-touch behavior can be used to add scale, to rotate, and to translate gestures to any element in a Windows Phone 7 Silverlight application. To use multi-touch you must first download and install the behavior from CodePlex at http://multitouch.codeplex.com

MULTI-TOUCH BEHAVIORS

The four basic multi-touch behaviors are as follows:

  • Rotate enables you to rotate the object up to 360 degrees.

  • Scale enables you to increase or decrease the size of the object.

  • Translate enables you to move the object around the screen.

  • Inertia applies friction (or easing) to objects when they are moved, allowing the object to stop smoothly. Easing functions allow you to apply custom mathematical formulas to your animations.

While these four basic behaviors can be directly controlled using the ManipulationStarted, ManipulationCompleted, and ManipulationDelta events, the multi-touch behaviors available from CodePlex encapsulate these events and make implementing them easy.

After installing MultiTouchBehaviors.Setup.msi, available from codeplex.com, you must add a reference to the assemblies to your Windows Phone 7 application. The assemblies are installed on your local machine at Program Files\MultiTouch Behaviors\WP7. The two assemblies that need references are:

  • MultiTouch.Behaviors.WP7.dll

  • System.Windows.Interactivity.dll

In order to use these two assemblies on a page you must add the following ...

Get Windows® Phone 7 Application Development 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.