We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do you make the grid expand all groups when the ItemsSource is replaced?


We have a scenario where a grid is used for a longer period of time, and the data is often changed (replaced) with new content. This is achieved by the ItemsSource being bound to a property which is changed. All of this works fine, except one small detail... All the groups are being collapsed when the ItemsSource-bound property is changed. :( This is even though we have set both PersistGroupsExpandState=True and IsGroupsExpanded=True on the grid.

I tried changing the ItemsSource to not be replaced entirely, but instead be an ObservableCollection which we Clear() and then add the items to. This had the exact same (incorrect) behavior.

Now, I can work around this by handling ItemsSource being changed, but clearly - isn't this an incorrect behavior in the grid? I feel that it shouldn't start collapsing things like this, just because the data it's bound to changes...

1 Reply

RG Rajasekar G Syncfusion Team June 20, 2013 07:25 PM UTC

Hi Per ,

Thank you for contacting Syncfusion support.

ExpandAllGroups method present in the GridDataTable is used to expand the groups present in the GridDataControl. GridDataControl contain event for each action. In this scenorio we have to use the ItemsSourceChanged event like below code snippet to expand the Groups while changing ItemsSource.

Code snippet[C#]:

this.gridDataControl.ItemsSourceChanged += new Syncfusion.Windows.ComponentModel.GridRoutedEventHandler(gridDataControl_ItemsSourceChanged);

void gridDataControl_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)




Please let us know if you have any questions.


Raja sekar.G

Live Chat Icon For mobile
Up arrow icon