Wednesday, 30 January 2013

Screen Orientation : Windows Phone

Windows phone apps support three different screen orientations:
a. Landscape -left
b. Landscape - right
c. portrait

In portrait the screen is in a vertical orientation , the height of the screen is more than the width.(480 * 800)
Landscape is when width is more than the height.(800*480)
Landscape right is when the status bar is towards your right and Landscape left is when the status bar is towards your left.

For the user rotating the device , changes the screen orientation.
For developers it will take a little more than a few lines of code to accommodate the orientation changes. They need to first understand what orientations are available , how does it affect the screen layout and how to take handle orientations.

The orientation of the screen can be changed :
a. By tilting the device.
b. By forcefully specifying the orientation changes for a particular screen.( A music composer screen)

By default your windows phone app has a portrait orientation.

Whether you should support screen orientation or not is not just a design or development consideration , but basically you need to keep in view your business requirements as well.

Suppose I have to develop an app (like a banking application) which has a virtual keyboard. Screen orientation of my app will  be crucial in deciding whether the virtual key board is visible to the users or not.

There are cases where you need to give the orientation changes for a particular page , instead of specifying it for the complete app.

SupportedOrientations is the property which need to be specified.

Supported Orientations takes three values:
a. Portrait
b. Landscape
c.PortraitOrLandscape

When you say you support landscape you need to support both left landscape and right landscape.

You can override OnOrientationChanged event of PhoneApplicationPage class.

When developing you can use the emulator to emulate orientation change.

There are two techniques to show screen layout and orienatation:
a. Scrolling technique
b. Grid Layout technique

We will look at each of these techniques in detail, but for now I will try to explain in brief what do we mean by these techniques

Scrolling technique : This is the technique where you place different controls inside a stack panel and assign a  scroll viewer to the stack panel.

Grid technique : In this you place the controls inside a grid and based on the orientation the grid places itself and so does the individual controls.

No comments:

Post a Comment