4
votes

I've created a Xamarin.Forms app that I want to only run in landscape orientation. This is easy enough for iOS, where setting the device orientation in Info.plist does the trick.

But for UWP, this does not appear to work. In Package.appxmanifest I've set the Supported rotations to Landscape only:

enter image description here

But I'm still able to rotate into portrait mode.

Is this a bug, and is there a workaround?

1
Check the XAML code in your App.xaml.cs, if I remember correctly there is another setting there. In your UWP project, that is.Gerald Versluis

1 Answers

2
votes

The orientation lock is only respected when the system is in the Tablet mode or in the Kiosk mode, because when the app is windowed, it is not possible to limit its orientation (user can change it freely).

Also note that maximized window <> Tablet mode, so even if the app view is maximized, it will still rotate freely.