I wanted my UWP app, running on windows 10, to support only Landscape orientations, but here is a one problem. First i founded this question: link
This example from GitHub works fine then I try to set orientation with checkboxes, and when i set orientation like this:
DisplayOrientations orientations = DisplayOrientations.Landscape;
DisplayInformation.AutoRotationPreferences = orientations;
it works too. Great.
But here is an issue. If you'll try to press Start to suspend app and press it again to resume app all rotation preferences will be set in default. It works like reset for rotation preferences.
I tried to set Suspending method, but it doesn't work. Tried with debugger and without it, this doesn't works. Setting "Supported rotations" and "Lock Screen" declaration in manifest file doesn't work too. Can somebody help me?
Maked like lokusking said.
Here is a link.
If setting this in Package.appxmanifest (double click / Landscape) is not enough if in tablet mode then you could try to set things when the App is resuming.
The best solution is here I think: You can lock the app in Landscape mode for example:
Then when you want to return auto rotation to user use the following code:
Regards