How to set Windows Phone Page orientation in 5 minutes

Dear Friends,

Today we start with some basic but important feature for Windows Phone which is Orientation of screen.  As we know windows mobile phone is handy device a user can handle it any ways like portrait or landscape. Our main aim here is to change our screen orientation according to user action. Windows phone page has two properties for this activity.

When you open the XAML of the page in the phone application page you will find SupportedOrientations and Orientation by default these properties having value Portrait.

Support Orientations can have following property

a) Landscape  (It support Landscape view only)

b) Portrait     ( It support Portrait View only)

c) PortraitOrLandScape  (It support both View )

While Orientation can have following values

a) Landscape

b) Portrait

c) LandscapeLeft

d) LandscapeRight

e) PortraitUp

f) PortraitDown

g) None

To change the page layout we need to set  supportOrientation property to “portraitOrLandscape” And design the page in such a way that it automatically resize according to screen and take their position else you have to do programming for it to put control at proper place.

In current example I have use stack panel and in this stack panel I have used image control. To enable page orientation I have just change the support orientation property.  To know we are seeing which orientation I have added an event which is page orientation event.

You can say it will be simplest example for more information please download the project. (indiandotnet_Wp7_PageOrientation.zip)

https://skydrive.live.com/?cid=1eda2012469ff8ad&id=1EDA2012469FF8AD!243

 

Thanks & Best Regards,

Rajat Jaiswal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s