SupportedOrientations unavailable in XAML of windows phone 8.1 app?

房东的猫 提交于 2019-12-23 09:41:50

问题


What is the equivalent of this in Windows Phone 8.1 App. When I create a new app, there is no more phone:ApplicationPage

<phone:PhoneApplicationPage
...
...
SupportedOrientations="Landscape" Orientation="LandscapeLeft"
shell:SystemTray.IsVisible="False">

回答1:


Yes, In windows phone 8.1, We can't set supportedOrientations in page's XAML. We can set supportedOrientations of App in Package.appxmanifest only.




回答2:


You can force the orientation of any page via code, writing just after the this.InitializeComponent():

DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;

or

DisplayInformation.AutoRotationPreferences = DisplayOrientations.LandscapeFlipped;

or

DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;


来源:https://stackoverflow.com/questions/23507672/supportedorientations-unavailable-in-xaml-of-windows-phone-8-1-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!