Skip to main content

Process Group Rows

  • 3 minutes to read

Group Rows and Group Levels

When grouping is applied, group rows organize data into a tree. Group rows are virtual objects. They do not exist in the grid’s data source. Group rows are automatically created when data grouping is applied to combine records with identical values within grouping columns. Ungrouping data automatically removes group rows. Data rows are displayed at the bottommost hierarchy level, and can be accessed by expanding group rows.

Group rows are uniquely identified by their handles. Group row handles are negative (starting from -1), determining the order in which group rows appear within a View according to the sort and filter settings. Refer to the Identifying Rows and Cards topic for more information.


Method Description
GridControl.IsGroupRowHandle Gets whether a row handle corresponds to a group row.
GridControl.GetRowLevelByRowHandle, GridControl.GetRowLevelByVisibleIndex Obtains the grouping level at which a row (group or data row) resides.

Obtain the Number of Group Rows

The total number of visible rows is returned by the DataControlBase.VisibleRowCount property. The GridControl.GetRowHandleByVisibleIndex method is used to obtain the processed row’s handle by its position within the view. The GridControl.IsGroupRowHandle method is used to identify whether the processed row is the group row.

using DevExpress.Xpf.Grid;

// ...
int GetVisibleGroupRowCount(GridControl grid) {
    int count = 0;
    for (int i = 0; i < grid.VisibleRowCount; i++) {
        int rowHandle = grid.GetRowHandleByVisibleIndex(i);
    return count;

The following code sample gets the total number of existing group rows:

using DevExpress.Xpf.Grid;

// ...
int GetTotalGroupRowCount(GridControl grid) {
    int groupRowCount = 0;
    for (int i = -1; grid.GetGroupRowValue(i) != null; i--)
    return groupRowCount;

Get Group Row Info

Method Description
GridControl.GetGroupRowValue Returns a value of the specified group row in the specified grouping column.
GridControl.GetGroupSummaryValue Returns the specified group summary value displayed within the specified group row.

Iterate Through Child Rows

To iterate through the child rows belonging to a group row, use the following methods:

Method Description
GridControl.GetChildRowCount Returns the number of child rows (group or data) contained within the specified group row.
GridControl.GetChildRowHandle Returns the handle of the row contained within the specified group row, at the specified position.
GridControl.GetParentRowHandle Returns the handle of the group row that owns the specified group or data row.

Custom Group Display Text

Member Description
GridControl.CustomGroupDisplayText Allows you to replace the default text within group rows.
GridControl.CustomGroupDisplayTextCommand Gets or sets a command that displays custom text in group rows.