Based on this tutorial I created a ListView with different groupers.
But I need to show the amount of elements within each group and the description of each, I am not allowed to use the generic word "Element (s)" in the groups, it has to be more personalized.
For example:
Primer Grupo (2 Segundos Grupos)
Segundo Grupo (1 Tercer Grupo)
Tercer Grupo 3 (2 Elementos)
Elemento 1
Elemento 2
Segundo Grupo (2 Terceros Grupos)
Tercer Grupo (3 Elementos)
Elemento 1
Elemento 2
Elemento 3
Tercer Grupo (1 Elementos)
Elemento 1
The aforementioned tutorial uses the following block of code to show the number of elements (the ItemCount
), but that amount is the total of elements, that is, the total of the elements of the last level, based on my example said total would have a value of 6 .
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander IsExpanded="True">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Gray" FontSize="22" VerticalAlignment="Bottom" />
<TextBlock Text="{Binding ItemCount}" FontSize="22" Foreground="Green" FontWeight="Bold" FontStyle="Italic" Margin="10,0,0,0" VerticalAlignment="Bottom" />
<TextBlock Text=" item(s)" FontSize="22" Foreground="Silver" FontStyle="Italic" VerticalAlignment="Bottom" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>