Windows Phone 8 and 7 – Locking the aspect ratio to portrait or landscape

I love apps that support orientation changes, it helps the user see content when they’re tucked up in bed, or just busting a gut on the way to work on the train. Sometimes however they are not suitable, or there might be bugs with one mode and not the other, and disabling a troublesome orientation might be the wisest move rather than drop quality. Here’s how you can do it in Windows Phone apps.

In MainPage.xaml, in the phone:PhoneApplicationPage section, add or change the following properties to set the available orientations to one of:

SupportedOrientations=”Portrait” 

SupportedOrientations=”PortraitOrLandscape”

SupportedOrientations=”Landscape”

You can then set the initial orientation to one of:

Orientation=”Portrait”

Orientation=”Landscape”

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