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.

How to apply the Custom Grouping while grouping the column using GroupDropArea?

In SfDataGrid, group represents the collection of records that belongs to a particular category. By default the grouping is applied based on the similar data in the Grid but you can customize the grouping by using your own grouping criteria. The Custom Grouping is achieved by assigning GroupColumnDescription converter in XAML or code behind. You can assign a converter that implements IValueConverter with the Custom Grouping logic.

The following code example demonstrates you how to use the converter for Custom Grouping.

C# (Converter)

The following code example demonstrates you how to add the Custom Grouping by using above converter in XAML.

XAML

The following code example demonstrates you how to add the Custom Grouping by using above converter in Code behind.

C#

The following screenshot shows the Custom Grouping in Grid after assigning the converter in XAML or Code Behind.

G:\Serialization KB\Custom Grouping\After.PNG

But when you group the column into GroupDropArea by drag and drop, the default grouping is only applied. Because, GroupColumnDescription is added internally for this case.

The following screenshot shows you the default grouping while drag and drop the same Date column into GroupDropArea.

G:\Serialization KB\Custom Grouping\Before.PNG

To achieve Custom Grouping while drag and drop the column, you need to assign the Converter with custom group logic for specific GroupColumnDescripion in GroupDescriptionsCollectionChanged event. After applying the converter to GroupColumnDescripion, the default grouping is not applied for that column and the Custom Grouping is applied.

The following code example demonstrates you how to assign the converter to GroupColumnDescription in GroupDescriptionsCollectionChanged event.

C#

 

Sample Links

 

WPF

WRT

SilverLight

UWP

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
6105 01/25/2016 02/05/2016 UWP SfDataGrid 4.5
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.