How to change behavior when changing the WinForms GridGroupingControl?
Grouping
While
modifying the content of the grouped records in the WinForms GridGroupingControl, the groups are not getting collapsed in the version
13.1.0.X (2015 Volume 1) of the Essential Studio.
Solution
From
the 13.1.0.X version of Essential Studio, the
default behavior is that when a group is added or modified, it does not
collapse all the other groups.
To collapse the entire group, except the distinct group created by adding or modifying the record, set the TableDirty property value as true in SourceListListChanged event. When a table is marked dirty, any subsequent access to child elements and the resulting Syncfusion.Grouping.Element.EnsureInitialized(System.Object) call triggers re-categorization of all records in the table.
C#
//Hook the event in Form to set the table value as dirty.
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged);
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e)
{
//Set the table as dirty
e.Table.TableDirty = true;
}
'Hook the event in Form to set the table value as dirty.
AddHandler Me.gridGroupingControl1.SourceListListChanged, AddressOf gridGroupingControl1_SourceListListChanged
Private Sub gridGroupingControl1_SourceListListChanged(ByVal sender As Object, ByVal e As TableListChangedEventArgs)
'Set the table as dirty
e.Table.TableDirty = True
End Sub
Figure 1: New group in table
Conclusion
I hope you enjoyed learning about how to change behavior when changing the GridGroupingControl.
You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!