I have a ListView and implemented Grouping with the code below in XAML,
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander x:Name="Exp" IsExpanded="{Binding Path=Items[0].IsExpanded,Mode=TwoWay}" BorderBrush="#FFCCCCCC" Background="White"
BorderThickness="0,0,0,1">
<Expander.Header>
<DockPanel>
<TextBlock>
<TextBlock FontWeight="Bold" Text="{Binding Path=Name}"
Margin="5,0,0,0" Width="Auto"/><Run Text=" ("/><TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}"/><Run Text=")"/></TextBlock>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
The Expand/Collapse is working fine.But, I want to save the the Group State onExit and load the application, in the same state the nxt LogIn. I am saving all the preferences in xml file.
Any Suggestions Please.