Skip to main content

Expanding and Collapsing Group Rows

  • 2 minutes to read

End-users can expand or collapse group rows by clicking group buttons via mouse.

#Expanding Group Rows in Code

To expand a group row, use the GridControl.ExpandGroupRow method. A group row is specified by its handle. To expand the focused group row, use the GridViewBase.ExpandFocusedRow method. All group rows can be expanded using the GridControl.ExpandAllGroups method.

Before a group row is expanded, a GridControl.GroupRowExpanding event is raised, allowing you to cancel the action. For instance, you can prevent an end-user from expanding individual group rows. After a group row has been expanded, a GridControl.GroupRowExpanded event is raised.

To identity whether a group row is expanded or not, use the GridControl.IsGroupRowExpanded method.

#Example: How to Prevent Group Rows from being Expanded

#Collapsing Group Rows in Code

To collapse a specified group row, use the GridControl.CollapseGroupRow method. To collapse a focused group row, use the GridViewBase.CollapseFocusedRow method. All group rows can be collapsed using the GridControl.CollapseAllGroups method.

Before a group row is collapsed, a GridControl.GroupRowCollapsing event is raised, allowing you to cancel the action. After a group row has been collapsed, a GridControl.GroupRowCollapsed event is raised.

#Example: How to Prevent Group Rows from being Collapsed

See Also