Reputation: 624
I would like to lock screen orientation to portrait only for mobile family. If I check only portrait in app manifest, it works: screen is locked in portrait orientation for mobile, but I think it is the same for tablets (Actually, I haven't tablet device for testing).
Upvotes: 1
Views: 763
Reputation: 9857
According to this SO answer UWP C# Disable Orientation Change Animation
You need to set your screen orientation in your OnNavigatedTo
override.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if(/*on phone*/)
{
DisplayInformation.AutoRotationPreferences = DisplayOrientation.//Your Enum Value
}
}
Here is a list of the DisplayOrientations off of the MSDN documentation
Upvotes: 4