C# Windows Phone定向不工作

C# Windows Phone定向不工作,c#,windows-phone-7,C#,Windows Phone 7,方向代码不起作用,但它是正确的 private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { if (e.Orientation == PageOrientation.Landscape) { webBrowser1.Visibil

方向代码不起作用,但它是正确的

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">

为什么?

将页面的SupportedOrientations属性更改为肖像或风景。 使用ScrollViewer和StackPanel替换内容面板部分中的默认网格。
在同一个链接上,您会发现该代码的方向正确

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

方向是纵向的吗?什么不起作用?在横向方向改变后,web浏览器而不是hiddeni改变了横向工作的属性和页面。我的问题是网络浏览器不是IDDEN!!它总是可见的