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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

109460 Jun 14,2013 08:23 AM UTC Jun 20,2013 07:25 PM UTC WPF 1
loading
Tags: GridControl
Per Lundberg
Asked On June 14, 2013 08:23 AM UTC

Hi,

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...

Rajasekar G [Syncfusion]
Replied On 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)

{

this.gridDataControl.Model.Table.ExpandAllGroups();

}

Please let us know if you have any questions.

Regards,

Raja sekar.G


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;