Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
     Grouping Overview
     Grouping Modes and Custom Grouping
     Tutorial: Custom Grouping Algorithms
     Tutorial: Group Row API
     Tutorial: Grouping Basics
     Process Group Rows
     Applying Styles to Group Rows
     Member Table: Grouping
     Member Table: Group Row API and Behavior
     Member Table: Group Summaries
     Member Table: Size, Style, Appearance and Animation
     Member Table: Grouping Modes and Custom Grouping
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Grouping Modes and Custom Grouping

This topic describes group modes, as well as the custom grouping feature that allows you to change the default grouping logic. For general information on grouping, refer to the Grouping Overview document.


In Server Mode, grouping data by column display values (ColumnGroupInterval.DisplayText) and custom grouping (GridView.CustomColumnGroup) are not supported. See Server Mode Limitations to learn more.

Expanded Online Video

Learn how to implement custom logic for grouping rows.

Expanded Group Modes

By default, when grouping by a column containing date/time values, only the date portion of values is taken into account and the time portion is ignored. Thus, rows that contain matching date portions, but different time portions in the grouping column, will be combined into a single group. For grouping columns containing other data types, the default grouping logic is straightforward: rows are combined into a single group if they have a matching value in a grouping column. In this instance, the number of groups in a View matches the number of unique values in the grouping column.

In certain instances, you may want to change the grouping logic, especially for columns containing date/time values. For instance, combine rows into a single group by the month or year part of date/time values, or perform Outlook style grouping (combine into groups: "Today", "Tomorrow", "Sunday", "Monday", "Tuesday", etc.). To change a grouping mode, use the column's GridColumn.GroupInterval property. The ColumnGroupInterval topic describes available grouping modes. In the following image, the Received column's GroupInterval property is set to ColumnGroupInterval.DateRange and thus data is grouped in the Outlook style.

In this example, the group row paint style has been customized using the GridOptionsView.GroupDrawMode property.

Expanded Custom Grouping

If the group modes introduced by the GridColumn.GroupInterval property don't suit your needs, you can group rows in a custom manner. The custom grouping feature allows you to implement custom logic for grouping rows. For instance, rows can be combined into intervals, depending upon a specific column's value.

To implement a custom grouping algorithm, handle the GridView.CustomColumnGroup event. This event is fired when a column's GridColumn.SortMode property is set to ColumnSortMode.Custom and the View's data is grouped by this column.

Refer to the GridView.CustomColumnGroup topic for more information and an example.

Expanded See Also

How would you rate this topic?​​​​​​​