我希望有一些像这样的输出,其中column1的宽度对于每一行都是相同的。
// [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
我希望将宽度定义为*,因为我事先并不知道字体大小,所以我希望它的大小适合内容。
这是我尝试过的,但它没有用,row1.column1的大小与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>