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

Obtaining the orientation of a device

A smartphone or a tablet can be placed in various orientations, such as with the screen faced down, up, or rotated. Fortunately, it is possible to easily get to know which orientation is currently being used and to adjust the design of the page if necessary. In this recipe, you will learn how to use the SimpleOrientationSensor class to get such information.

As an example, you will create a simple page with information about the current orientation. Of course, such content will be updated automatically as soon as the reading has changed.

Getting ready

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

How to do it...

To prepare an example presenting an information about the current orientation ...

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