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

本文关键字:高度 100% 旋转 WebBrowser 控件 Windows Phone | 更新日期: 2023-09-27 18:13:22

我正在构建我的第一个简单的Windows Phone应用程序,但我遇到了一些麻烦。

我正在使用一个WebBrowser控件来显示一个我没有控制的网页。由于某些原因,控制不随手机旋转。我完全不知道为什么。

我无法让手机的高度达到100%。如果我设置它为auto,我认为它会作为0执行。

有谁能帮我一下吗?

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

这是一个非常简单的应用程序的XAML,它只包含一个WebBrowser控件。它是全尺寸的,可以旋转。你能否将自己的应用与自己的应用进行比较,找出不同之处?顺便说一句,我在元素上改变的唯一属性是@ supportedorientation的值。

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

希望这能让你走上正确的道路!