ALTERING DEVICE ORIENTATION
One of the simplest ways you can interact with a Windows Phone 7 device is to detect both its current orientation and when orientation changes occur. Orientation, in a mobile device sense, simply means whether you're holding it vertically upright or in another position, such as on its side. Vertical orientation is referred to as portrait orientation, and horizontal orientation is called landscape orientation.
You might wonder why orientation is important. Indeed, in many applications it isn't important. However, sometimes it's useful to know how the device is being held so that you can change the display accordingly. This enables you to enhance the usability of your applications. For example, you might display list data in a different way or change the layout of onscreen elements, depending on the orientation. Alternatively, you might want to force a particular orientation so that your application looks the same however the device is oriented.
The PhoneApplicationPage class exposes a property called, unsurprisingly, Orientation. This property is of the enumeration type Microsoft.Phone.Controls.PageOrientation, which has the members shown in Table 6-1.
The values defined for the PageOrientation enumeration members make it easier to detect whether a given orientation is portrait or landscape by using bitwise ...