【发布时间】:2011-11-13 21:18:24
【问题描述】:
我正在用 C# 编写一个 Windows Phone 应用程序。我有一个设置OrientationLock,应该将屏幕锁定为纵向。不幸的是,我一辈子都无法让它发挥作用。设置保存和一切,我只是不知道如何在 C# 中更改支持的方向。这是我正在尝试使用的代码:
public MainPage()
{
InitializeComponent();
if (AppSettings.Default.OrientationLock)
{
this.SupportedOrientations = SupportedPageOrientation.Portrait;
}
else
{
this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
}
}
谢谢。
【问题讨论】:
-
在模拟器和 Mango 设备上工作得很好。
-
不确定,如果设置了它只是不会锁定方向。
标签: c# xml xaml windows-phone-7