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 do custom grouping in GridGroupingControl?

Solution

A more general way of categorizing records is to add own custom categorizer object to the SortColumnDescriptor that defines the group. You can also add a custom comparer object to the SortColumnDescriptor. When a column is grouped, it is first sorted. The Comparer object allows you to control how the sorting is done on your column. Once the column is sorted, the custom categorizer is used to determine the adjacent records in the sorted column that belong to the same group. To create custom comparer and categorizer objects, you can define classes that implement either IComparer (one method) or ICategorizer (two methods).

Custom Categorizer:

C#

 

VB

 

Custom Comparer class:

C#

 

VB

 

In the Form_Load event, you can add the categorizer to the grouped columns.

C#

 

VB

 

 

Figure 1: custom grouping

Sample Links:

CustomGrouping-CS.zip

CustomGrouping-VB.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
498 04/30/2011 04/20/2015 Windows Forms GridGroupingControl
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.