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

How to add selection to data rows of each group while expanding its CaptionSummaryRow?

Platform: UWP |
Control: SfDataGrid |
.NET Framework: 4.5.1 |
Product Version:

SfDataGrid allows you to enable Grouping, by setting the AllowGrouping property at SfDataGrid or Column level. Each group contains its own GroupCaptionRow and you can get the underlying records by expanding it.

The following screenshot displays two levels of grouped columns in SfDataGrid.

Figure 1 : Default structure of Grouping and its elements

By default, the selection is maintained in CaptionSummaryRow when the group is expanded or collapsed. You can customize and maintain the selection in its underlying records also, while expanding the corresponding group.

Using the GroupExpanded event, you can process the selection to its underlying records of each group. The following code example illustrates, how to wire the GroupExpanded event in SfDataGrid.


In the above code, GroupExpanded event is fired when the group is expanded and you can get the corresponding group and its underlying records from the GroupExpanded event argument as illustrated in the following code example.


The GroupExpanded contains the following argument,

Sender: The Sender is SfDataGrid.

GroupChangedEventArgs: GroupChangedEventArgs class contains Group property that provides the currently expanded group.

In the above code example, you can get the expanded group, from the GroupExpanded event argument. You can process the selection to CaptionSummaryRow of current group and its underlying records recursively by using CheckGroup() helper method as illustrated in the following code example.


In the above code example, check whether the next level of parent group contains records or sub groups. When the next level is records, the selection is added by using the SelectRows (int StartIndex, int EndIndex) method. Set the current CaptionSummaryRow index as startRowIndex and the end of record collection as endRowIndex. The startRowIndex and endRowIndex is resolved from record index of CaptionSummaryRow and records.

When the next level contains group ,the CheckGroup() method is called recursively until the records are found and the selection is processed by passing the parent group index as startRowIndex and end of sub groups as endRowIndex in SelectRows() method .

The following screenshot illustrates the customized selection of CaptionSummaryRow and Records when the group is expanded.

Figure 2 : Selection added to records of expanded group

C:\Users\ApoorvahR\Desktop\Note.pngNote: To maintain multiple row selection, set the SelectionMode as Multiple.


Sample Links:




2X faster development

The ultimate UWP UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile