O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling the rotate touch event

The last touch event, analyzed in this chapter, is rotation. It is very useful, for example, to rotate the image, as you will see in this recipe.

Getting ready

To step through this recipe, you need only the automatically generated project.

How to do it...

To prepare the example that handles the rotate touch event to rotate the image presented on the page, perform the following steps:

  1. Add the Photo.jpg file to the Assets directory.
  2. Add an image to the page, support the necessary manipulation modes, and define a rotation transform. Do this by modifying the content of the MainPage.xaml file, as follows:
            <Page (...)> 
                <Grid> 
                    <Image Source="/Assets/Photo.jpg" ImageOpened="Image_ImageOpened" ManipulationMode="Rotate,RotateInertia" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required