我有一个带有 GroupStyle 的 WPF DataGrid
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Header>
<StackPanel>
<TextBlock Text="{Binding Path=citta}" Margin="5,0,0,0" Width="100" FontWeight="Bold"/>
<TextBlock Text="{Binding Path=ItemCount}" />
</StackPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
后面的代码:
var qq = (from a in q select new { formareg = a.Get("formareg"), citta = a.Get("citta"), conteggio = a.Get("conteggio"), parametro = a.Get("idcitta").ToString() + "|" + a.Get("formareg") }).OrderBy(x => x.citta).ToList();
ListCollectionView cv = new ListCollectionView(qq);
cv.GroupDescriptions.Add(new PropertyGroupDescription("citta"));
GrigliaDati.ItemsSource = cv;
一切正常,但在每个组的标题中我只看到 ItemCount 而不是 Path=citta。
怎么了??