0

I want to have some output like this where the width of column1 is the same for each row.

// [year color make model]  [ - lic # - state]  //want column1 size to match for both rows
// [year color make model]  [ - lic # - state]  //want column1 size to match for both rows

I want the width to be defined as *, because I don't know the font size in advance, so I want it to size to content.

Here's what I tried, but it didn't work, row1.column1 size was different than row2.column1

 <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=VehicleYear}" Foreground="Blue" Margin="0,0,5,0" />
                        <TextBlock Text="{Binding Path=ColorExteriorID, Converter={BLL:CodeMarkupExtension}}" Foreground="Blue"  Margin="0,0,5,0" />
                        <TextBlock Text="{Binding Path=MakeID, Converter={BLL:CodeMarkupExtension}}" Foreground="Blue" Margin="0,0,5,0" />
                        <TextBlock Text="{Binding Path=Model}" Foreground="Blue" Margin="0,0,5,0" />
                    </StackPanel>
                    <StackPanel Grid.Column="1" Orientation="Horizontal">
                        <TextBlock Text="-" Foreground="Blue" Margin="0,0,5,0" />
                        <TextBlock Text="{Binding Path=PlateNumber}" Foreground="Blue" Margin="0,0,5,0"/>
                        <TextBlock Text="-" Foreground="Blue" Margin="0,0,5,0" />
                        <TextBlock Text="{Binding Path=StateID, Converter={BLL:CodeMarkupExtension}}" Foreground="Blue" Margin="0,0,5,0" />
                    </StackPanel>
                </Grid>
patrick
  • 16,091
  • 29
  • 100
  • 164

1 Answers1

3

I think what you are looking for is ColumnDefinition/RowDefinition.SharedSizeGroup

See also

Community
  • 1
  • 1
ungood
  • 582
  • 6
  • 9