我正在制作一个简单的排行榜。我想要的是让团队名称列标签与其所在的网格列大小相同。
<ListView x:Name="TeamList" Background="#00000000" BorderBrush="#00000000">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style>
<Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<!-- more columns for points -->
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="#4Fd5f4ff" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="#4Fd5f4ff">
<Label Width="50"
HorizontalAlignment="Center" HorizontalContentAlignment="Center"
VerticalAlignment="Center" VerticalContentAlignment="Center" FontSize="23" FontWeight="Bold"
Foreground="Black">#1</Label>
</Border>
<!-- This is shortened to the size of the content -->
<Border Grid.Column="2" BorderBrush="#7Fd5f4ff" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="#7Fd5f4ff">
<Label Height="40" Content="{Binding Path=Name}"
FontSize="19" FontWeight="Bold" Padding="20 0 0 0"
Foreground="Black" VerticalContentAlignment="Center" VerticalAlignment="Center"></Label>
</Border>
<!-- More columns for points -->
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
上面列出了主题名称,但边框/标签的宽度被缩短为实际内容的大小。
我怎样才能让标签扩展到网格列的大小 * ?