質問

How can I make that bing maps take all place below.

First row is name Second row is last name: Third name is map.

I want that bing maps takes everything from third row to all the way down. Maps should be in column 1 and column 2

    <!--LayoutRoot is the root grid where all page content is placed-->
<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,28">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0">First name:</TextBlock>
        <TextBlock Grid.Row="1" Grid.Column="0">Last name:</TextBlock>
        <TextBlock Grid.Row="0" Grid.Column="1">name</TextBlock>
        <TextBlock Grid.Row="1" Grid.Column="1">name</TextBlock>
        <my:Map Grid.Row="2" Grid.Column="1" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    </Grid>
</Grid>
役に立ちましたか?

解決

Make the row and column fill the rest of the container with "*"

Also use Grid.ColumnSpan="2" so that the map spans across two columns

<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,28">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0">First name:</TextBlock>
        <TextBlock Grid.Row="1" Grid.Column="0">Last name:</TextBlock>
        <TextBlock Grid.Row="0" Grid.Column="1">name</TextBlock>
        <TextBlock Grid.Row="1" Grid.Column="1">name</TextBlock>
        <my:Map Grid.Row="2" Grid.ColumnSpan="2" />
    </Grid>
</Grid>

他のヒント

For a row to take up the remainder of space, you need to use the "*" GridLength setting for its Height:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="200"></ColumnDefinition>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Row="0" Grid.Column="0">First name:</TextBlock>
    <TextBlock Grid.Row="1" Grid.Column="0">Last name:</TextBlock>
    <TextBlock Grid.Row="0" Grid.Column="1">name</TextBlock>
    <TextBlock Grid.Row="1" Grid.Column="1">name</TextBlock>
    <my:Map Grid.Row="2" Grid.Column="1" Width="Auto" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</Grid>

You can find out full details from the Grid Class page on MSDN.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top