Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have already specified in the manifest as Landscape and LandscapeFlipped, I know this is just a preference and on top of this I've added the below code in the App.xaml.cs OnLaunched. But yet when tested on a tablet the app goes back to portrait mode.

 DisplayInformation.AutoRotationPreferences = 
                     DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped;

Also is there any alternative way I could test this in a simulator instead of an actual tablet/device?

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
339 views
Welcome To Ask or Share your Answers For Others

1 Answer

Since my comment helped you im going to add it as answer

Reference

Solution

[DllImport("user32.dll", EntryPoint = "#2507")]
extern static bool SetAutoRotation(bool bEnable);

SetAutoRotation(false);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...