有没有更好的方法来对齐列?当文本更改时,第 3 列和第 4 列会到处移动。我尝试将宽度设置为 * 和自动,但似乎没有任何效果。
<ListBox Height="Auto" BorderThickness="0" MouseDoubleClick="OnMouseDoubleClick" ItemsSource="{Binding Path=Results}" SelectedItem="{Binding Path=Entry, Mode=TwoWay}" AlternationCount="2">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="150"></ColumnDefinition>
<ColumnDefinition MinWidth="150"></ColumnDefinition>
<ColumnDefinition MinWidth="150"></ColumnDefinition>
<ColumnDefinition MinWidth="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontFamily="Sagoe UI" FontSize="14"
Text="{Binding FullName}" Padding="2" />
<TextBlock Grid.Column="1" FontFamily="Sagoe UI" FontSize="14"
Text="{Binding Company}" Padding="2" />
<TextBlock Grid.Column="2" FontFamily="Sagoe UI" FontSize="14"
Text="{Binding BusinessPhone}" Padding="2" />
<TextBlock Grid.Column="3" FontFamily="Sagoe UI" FontSize="14"
Text="{Binding EmailAddress}" Padding="2" >
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>