C# 如何在XAML或代码中设置和限制页面方向?

C# 如何在XAML或代码中设置和限制页面方向?,c#,xaml,windows-phone-8.1,orientation,C#,Xaml,Windows Phone 8.1,Orientation,如何在XAML或代码中设置和限制页面方向(适用于Windows Phone 8.1)?您需要执行以下操作 void appBarButton_Click(object sender, EventArgs e) { this.SupportedOrientations = SupportedPageOrientation.Landscape; this.Orientation = PageOrientation.Landscape; }

如何在XAML或代码中设置和限制页面方向(适用于Windows Phone 8.1)?

您需要执行以下操作

void appBarButton_Click(object sender, EventArgs e)
{
   this.SupportedOrientations = SupportedPageOrientation.Landscape;
   this.Orientation = PageOrientation.Landscape;
}