locked
How do I determine what orientations are supported by a device.

    Question

  • How do I determine what orientations are supported by a device.  For example, when my app runs on a PC, portrait orientation is not supported.  Is there a way to determine that?

    Thanks.

    Sunday, June 9, 2013 11:34 PM

Answers

All replies

  • You can get the current orientation and the native orientation (where the buttons will match up most naturally, etc.). What is the scenario that needs the supported orientations?

    See Windows.Graphics.Display.DisplayProperties' CurrentOrientation and NativeOrientation properties.

    --Rob

    Sunday, June 9, 2013 11:49 PM
    Owner
  • I have an app which runs mostly in landscape.  However there is one page which is best viewed in portrait and I would like to automatically change to portrait if it is available.  I have found that, for a tablet, I can set DisplayProperties::AutoRotationPreferences to 'Portrait | PortraitFlipped' when I am about to display the page, and it will force the tablet to change to Portrait orientation.  However on a PC, this does nothing.  I can monitor OnWindowSizeChange to detect that the orientation has changed for the tablet and then load the page as portrait, but this callback never happens for the PC.  I really need to know what orientation it is going to end up in before I create the view that is to be displayed, so I can know whether to set the AutoRotationPreferences and wait for the OnWindowSizeChange, or just go ahead and create the page as landscape.

    Thanks.

    Monday, June 10, 2013 12:38 AM