0

WebBrowser コントロールがあるページのレイアウトで問題が発生しています。

私の XAML の重要な部分は次のとおりです。

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,12">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="{Binding Title}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <StackPanel Grid.Row="1" Margin="12,17,0,12">
        <phone:WebBrowser Name="HtmlBody" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Red" Margin="12,17,0,28"/>
    </StackPanel>
</Grid>

私の質問は、WebBrowser をどのようにすればよいかということです。プロパティを auto に設定しても役に立ちません。これを行うと、デフォルトで高さが 0 になります。

何か案は?

4

1 に答える 1

1

次のように、StackPanel の代わりに Grid を使用し、2 行目の高さを「*」に設定します。

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,12">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="{Binding Title}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid Grid.Row="1" Margin="12,17,0,12">
        <phone:WebBrowser Name="HtmlBody" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Red" Margin="12,17,0,28"/>
    </Grid>
</Grid>
于 2012-09-13T08:32:23.983 に答える