You can also modify the Expander Header to display the number of records inside a group. The ItemCount property can be used to display the record count. Modify the Expander.Header, as shared here, to customize it:
<Expander.Header> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Name}" Margin="5,0,0,0"/> <StackPanel Orientation="Horizontal"> <TextBlock Margin="5,0,0,0" Text="{Binding Path=ItemCount}"/> <TextBlock Text=" Item(s)"/> </StackPanel> </StackPanel> </Expander.Header>
Now build and run the application again. Once the window loads, click on the checkbox to group the records by department name. Observe the item count in the expander, as shown here: