Windows Phone 8.1 and Windows Runtime Apps How to #9 – Set Supported Orientations in WP 8.1

In Windows Phone 8.1 App , if you want to set the supported orientations , you can set it in the Package.appxmanifest . In the previous version of Windows Phone (Windows Phone 8) , you can set it in the XAML page with the property SupportedOrientations=”Landscape” for the phone:PhoneApplicationPage element.

In Windows Phone 8.1 , you need to set this in the Package.appxmanifest file.

How to Set Supported Orientations in Windows Phone 8.1 ?

1. Double click on the Package.appxmanifest from the solution explorer .
2. In the Application tab , selected the supported orientations from the Checkboxes available under “Supported Rotations“. The possible options includes

  • Landscape
  • Portrait
  • Landscape-Flipped

image

3. Save the Project and build it.

How to Change the Orientation of the Page in Windows Phone 8.1 App ?

To change the orientation of the page in the Windows Phone 8.1 app , the developers can set the DisplayInformation.AutoRotationPreferences with one of the values from the DisplayOrientations enum .

async private void Button_Click(object sender, RoutedEventArgs e)
{
   Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Portrait;

}

Leave a Reply