2011-11-03 44 views
0

我正在構建我的第一個簡單的Windows Phone應用程序。雖然我有些麻煩。Windows Phone WebBrowser控件不旋轉,高度不是100%

我正在使用WebBrowser控件來顯示我無法控制的網頁。 由於某些原因,控件不會隨電話旋轉。我完全不知道爲什麼。

我無法獲得100%的手機高度。如果我將它設置爲auto,我認爲它被執行爲0.

任何人都可以幫助我嗎?

回答

2

下面是僅包含WebBrowser控件的非常簡單的應用程序的XAML。它是全尺寸和旋轉。你能比較你的應用程序,並發現有什麼不同?順便說一句,我改變的元素的唯一屬性是@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> 

希望能讓你走上正確的道路!

+0

謝謝。忘了設置VerticalAlignment我想。無論是關於行= 1還是類似的東西。 – JacobTheDev

+0

它不適用於Windows Phone 8 - 即使使用VerticalAlignment =「Stretch」,WebBrowser也會獲得0高度 – JustAMartin