在 windows phone store app 中,判断和设置页面横竖屏的方法,与 silverlight 中的 Page 类

不同,不能直接通过 Page.Orientation 进行设置。而是通过 DisplayInformation 类,方法如下:

// 横屏
Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Landscape; 

 

 

枚举值分别:

    [SupportedOn(100794368, Platform.Windows)]
    [SupportedOn(100794368, Platform.WindowsPhone)]

    public enum DisplayOrientations
 {None = 0,  Landscape = 1,Portrait = 2, LandscapeFlipped = 4, PortraitFlipped = 8, }

 

通过 ApplicationView 的 Orientation 属性,可以获得当前视图的方向,但是它是只读的:

 

01、Windows Store APP 设置页面横竖屏的方法

 

01、Windows Store APP 设置页面横竖屏的方法

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2021-12-25
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案