[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Get Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
     Working with Groups in Code
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [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]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Working with Groups in Code

Expanded Group and Ungroup Data


Groups data against this column. If data is already grouped by other columns, this column will be added to the end of the grouping queue.


Removes data grouping by this column.


Removes all data grouping.


Accepts non-negative integer values that specify the column order according to which data is grouped. Values must be unique, which means you cannot apply merged column grouping by setting column group indexes. You can change this property only for columns that have already been added to a View.


A collection that stores specific ColumnSortInfo objects on every grid column involved in sorting and grouping. To apply complex grouping in code, modify this collection manually by calling the GridColumnSortInfoCollection.ClearAndAddRange method. The code below applies two grouping layers: merged grouping by "Ship Country", "Ship City" and "Ship Region" columns, followed by tier two grouping by the "Customer ID" column.

ColumnView.StartGrouping, ColumnView.EndGrouping

Non-cancelable events that fire whenever a grouping operation takes place.

Expanded Modify Group Row Content

GridView.GroupFormat, GridColumn.GroupFormat

Allows you to modify group row content for individual Grid columns, or all columns at once.


Allows you to modify specific group row captions.


Allows you to display Group Summaries within group rows.

Expanded Custom Grouping


Set this property to Custom to implement custom grouping.


Fires for all columns with the custom sort mode when grid data is grouped against these columns. Allows you to implement custom grouping algorithms.

ColumnView.CustomColumnDisplayText or GridView.CustomDrawGroupRow

Handle any of these events to modify group row captions accordingly to your custom grouping algorithms. The sample below illustrates how to break order dates into four seasons and group orders by these seasons.

Expanded Locate and Process Group Rows

Row Handles

Row handles are integer values that identify both data (positive values) and group (negative values) rows.


Identifies the nesting level of a row.


Returns the number of immediate child rows for a group row.


Returns the row handle of a group row's child data row. The following example shows how to change the "Price" column value for all the data rows belonging to the focused data group. Prices change when end-users press the "Discount" button.


Returns the row handle of a parent row.


Methods that retrieve System.Data.DataRowView or other objects, which represent data source rows.

Expanded Expand and Collapse Rows


Returns whether or not the row is expanded.


Call this method to expand or collapse a row.


Expands or collapses a row itself and (optionally) all of its child rows.


Cancelable events that fire when a group is to be expanded or collapsed.


These events occur after a row has been expanded or collapsed.


Scrolls the View to display the required row and selects this row. Expands the row's parent group.


Scrolls the View to display the required row. If the row belongs to a group, this group expands. The code snippet below displays all rows whose "InStock" column values equal false.

Expanded See Also

Is this topic helpful?​​​​​​​