简体   繁体   English

Windows Phone WebBrowser控件不旋转,高度不是100%

[英]Windows Phone WebBrowser Control Not Rotating, Height Not 100%

I'm building my first simple Windows Phone app. 我正在构建我的第一个简单的Windows Phone应用程序。 I'm having some trouble though. 我虽然遇到了一些麻烦。

I'm using a WebBrowser control to show a web page that I don't have control over. 我正在使用WebBrowser控件来显示我无法控制的网页。 For some reason, the control doesn't rotate with the phone. 出于某种原因,控件不会随手机一起旋转。 I'm completely at a loss as to why. 我完全不知道为什么。

I can't get the height to be 100% of the phone. 我不能让高度成为手机的100%。 If I set it to auto, I think it's getting executed as 0. 如果我将它设置为auto,我认为它将被执行为0。

Can anyone help me with this? 谁能帮我这个?

Here's the XAML for a very simple app that only contains a WebBrowser control. 这是一个非常简单的应用程序的XAML,它只包含一个WebBrowser控件。 It is full size and rotates. 它是全尺寸并旋转。 Can you compare with your app and spot what's different? 你可以与你的应用程序进行比较,发现有什么不同吗? BTW, the only attribute I changed on the elements was the value of @SupportedOrientations. 顺便说一句,我在元素上改变的唯一属性是@SupportedOrientations的值。

<phone:PhoneApplicationPage 
    x:Class="WP7WebBrowser.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Transparent">
      <phone:WebBrowser Source="http://www.bing.com"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch" />
    </Grid>

</phone:PhoneApplicationPage>

Hope that puts you on the right path! 希望能让你走上正确的道路!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM