Windows Phone方向不工作

本文关键字:工作 方向 Phone Windows | 更新日期: 2023-09-27 18:16:19

方向代码不工作,但正确

private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
            {
                if (e.Orientation == PageOrientation.Landscape)
                {
                    webBrowser1.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                }
            }

是应用程序调用方向模式的代码:

SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    shell:SystemTray.IsVisible="True" OrientationChanged="PhoneApplicationPage_OrientationChanged">

为什么?

Windows Phone方向不工作

改变页面的SupportedOrientations属性为PortraitOrLandscape。用ScrollViewer和StackPanel替换Content Panel部分中的默认网格。http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207002%28v=vs.105%29.aspx在相同的链接

这段代码对于方向是正确的

if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
            {