How can I show grouping in a WPF Data Grid with multiple levels?
- by Keith
I am relatively new to WPF, so I understand about Styles and setters, but I am having trouble on this one.
I am using a WPF Data Grid and need to show multiple levels of grouping. I would like the 2nd and 3rd group levels to be more indented than the top level.
The following code will show group levels, but it shows them one right on top of the other and makes the fact that they are nested group levels impossible to tell.
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Header>
<TextBlock Text="{Binding Path=Name}"/>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
How can I get the group header to indent based on level?