Skip to main content
A newer version of this page is available. .

How to: Obtain the Number of Group Rows Displayed within a View

This example shows how to obtain the total number of group rows displayed within a view.

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;

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