我正在開發Windows Phone應用程序。WebBrowser帶邊緣的奇怪行爲
我有以下XAML代碼用戶控件:
<UserControl x:Class="XXXXXXX.Views.SignIn.FacebookControl"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="768" d:DesignWidth="480">
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<!--ContentPanel. Colocar aquí el contenido adicional-->
<Grid x:Name="ContentPanel" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="1"
Height="30"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Visibility="Visible"
Margin="10"
Name="LoadingText"
Text="{Binding Path=AppResources.BrowserNavigating, Source={StaticResource LocalizedStrings}}"/>
<phone:WebBrowser
Grid.Row="0"
Name="FacebookLoginBrowser"
IsScriptEnabled="True"
Height="607"
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
Margin="0,10"
Navigated="FacebookLoginBrowser_Navigated"
Loaded="FacebookLoginBrowser_Loaded"
Navigating="FacebookLoginBrowser_Navigating"/>
</Grid>
</Grid>
</UserControl>
我是得到這樣的:
WebBrowser
有左邊界,比其右頁邊距大。
UPDATE
這就是我如何嵌入我的用戶控制:
facebookControl = new FacebookControl();
facebookControl.SetValue(Grid.RowSpanProperty, 2);
facebookControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
facebookControl.VerticalAlignment = System.Windows.VerticalAlignment.Top;
facebookControl.Margin = new Thickness(0);
facebookControl.Height = 768;
facebookControl.Width = 480;
ContentPanel.Children.Add(facebookControl);
這是對的ContentPanel的定義:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
...
我該如何解決這個問題?
您的行'Margin =「0,10」'可能與它有關。您是否嘗試將其設置爲單個數字,以便所有邊距都相同? – johnhforrest 2011-04-13 16:25:46
@johnhforrest:我已更改爲0,並且遇到同樣的問題。 – VansFannel 2011-04-13 17:08:39