0

私はこれらのような 4 つの texboxs を持つグリッドを持っています:

私が持っているもの

そして、私はこれを取得したいと思います:

私が欲しいもの

私は列スパンで遊んでみましたが、成功しませんでした:(

<Grid Margin="20,0,0,20" VerticalAlignment="Top" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
    <RowDefinition />                                           
    <RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock  Grid.ColumnSpan="1" Grid.Row="0" Grid.Column="0" Margin="0,0,10,0" x:Name="TxtBox_CodeTiers" TextWrapping="Wrap" Text="{Binding m_strCode}"  HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23"/>
<TextBlock  Grid.ColumnSpan="1" Grid.Row="0" Grid.Column="1" Margin="0,0,10,0" x:Name="TxtBox_NomTiers" TextWrapping="Wrap" Text="{Binding m_strNom}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23" />
<TextBlock  Grid.Row="1" Grid.Column="0" Margin="0,0,05,0" x:Name="TxtBox_CPostal" TextWrapping="Wrap" Text="{Binding m_strCpostal}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"/>
<TextBlock  Grid.Row="1" Grid.Column="1" Margin="0,0,05,0" x:Name="TxtBox_Ville" TextWrapping="Wrap" Text="{Binding m_strVille}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"/>
</Grid>

これでより良い:)

<Grid Margin="12,0,0,20" VerticalAlignment="Top" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
    <RowDefinition />                                           
    <RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition/>
    <ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2"  x:Name="TxtBox_CodeTiers" Margin="0,0,20,0" TextWrapping="Wrap" Text="{Binding m_strCode}"  HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23" Loaded="TxtBlock_Loaded"/>
<TextBlock Grid.Row="0" Grid.Column="2"  x:Name="TxtBox_NomTiers" TextWrapping="Wrap" Text="{Binding m_strNom}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23" Loaded="TxtBlock_Loaded"/>
<TextBlock Grid.Row="1" Grid.Column="0"  x:Name="TxtBox_CPostal" Margin="0,0,20,0" TextWrapping="Wrap" Text="{Binding m_strCpostal}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}" Loaded="TxtBlock_Loaded"/>
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" x:Name="TxtBox_Ville" TextWrapping="Wrap" Text="{Binding m_strVille}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"  Loaded="TxtBlock_Loaded"/>
</Grid>
4

2 に答える 2

1

おそらく、「C」ボックスと「D」ボックスを並べるために別の列を追加する必要があります。次にColumnSpan、「A」ボックスに を設定して、新しい列にまたがります。

  <Grid Margin="20,0,0,20" VerticalAlignment="Top" HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="121*"/>
            <ColumnDefinition Width="52*"/>
            <ColumnDefinition Width="190*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.ColumnSpan="2"  x:Name="TxtBox_CodeTiers" TextWrapping="Wrap" Text="AAAAAAAAA"  HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23"/>
        <TextBlock Grid.Row="0" Grid.Column="2"  x:Name="TxtBox_NomTiers" TextWrapping="Wrap" Text="BBBBBBBB"   HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23" />
        <TextBlock Grid.Row="1" Grid.Column="0"  x:Name="TxtBox_CPostal" TextWrapping="Wrap" Text="CCCCCCCCCCC"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"/>
        <TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" x:Name="TxtBox_Ville" TextWrapping="Wrap" Text="DDDDDDDDD"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"  />
    </Grid>

ここに画像の説明を入力

ここに画像の説明を入力

于 2013-01-28T21:14:28.030 に答える
0

2 番目のグリッド行で使用できますStackPanel

<Grid Margin="20,0,0,20" VerticalAlignment="Top" HorizontalAlignment="Stretch">
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <TextBlock  Grid.ColumnSpan="1" Grid.Row="0" Grid.Column="0" Margin="0,0,10,0" x:Name="TxtBox_CodeTiers" TextWrapping="Wrap" Text="{Binding m_strCode}"  HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23"/>
    <TextBlock  Grid.ColumnSpan="1" Grid.Row="0" Grid.Column="1" Margin="0,0,10,0" x:Name="TxtBox_NomTiers" TextWrapping="Wrap" Text="{Binding m_strNom}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="23" />      
    <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2">
        <TextBlock Margin="0,0,05,0" x:Name="TxtBox_CPostal" TextWrapping="Wrap" Text="{Binding m_strCpostal}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"/>
        <TextBlock Margin="0,0,05,0" x:Name="TxtBox_Ville" TextWrapping="Wrap" Text="{Binding m_strVille}"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="{StaticResource PhoneDisabledBrush}"/>
    </StackPanel>
</Grid>
于 2013-01-28T21:19:58.487 に答える