Hi Olivia,
The only way to do this is to program it yourself. Currently, when the data source is refreshed, the DataGrid will expand or collapse the groups depending on the InitiallyExpanded property. You will need to save the settings and reload them once the data source is refreshed. I had written this piece of code that will pay attention to all groups that have been expanded or collapse and reapplies them once the collection view has been refreshed. It is more of a hack, but it is the only way to get this feature working right now:
C#
---------------
DataGridCollectionView view = this.MyDGC.ItemsSource as DataGridCollectionView;
if (view == null) { return; }
//if there aren't any groups, just refresh
if (view.Groups.Count < 1)
{
view.Refresh();
return;
}
bool[] expandedGroups = new bool[view.Groups.Count];
for (int i = 0; i < view.Groups.Count; i++)
{
expandedGroups
= this.MyDGC.IsGroupExpanded(view.Groups
as CollectionViewGroup);
}
view.Refresh();
for (int i = 0; i < view.Groups.Count; i++)
{
if (!expandedGroups
)
this.MyDGC.CollapseGroup(view.Groups
as CollectionViewGroup);
}
---------------
Marc
Developer in Technical Support
Xceed - Multi-talented components - http://xceed.com