Skip to main content
All docs
V24.1

SpreadsheetControl.GroupStateChanging Event

Fires before row or column groups are expanded or collapsed.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Win.Spreadsheet

Declaration

public event GroupStateChangingEventHandler GroupStateChanging

Event Data

The GroupStateChanging event's data class is GroupStateChangingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
Groups Returns information about groups affected by the expand/collapse operation.
IsExpanding Indicates whether a user is going to expand groups.
IsRowGroup Indicates whether a user starts to expand/collapse row groups.

Remarks

The WinForms Spreadsheet control ships with a set of events that allow you to control the expand/collapse operations for row and column groups in a worksheet.

The following events occur when a user clicks a plus Spreadsheet - Plus Outline Symbol / minus Spreadsheet - Minus Outline Symbol symbol on the outline bar (or the Hide Detail/Show Detail button on the Data ribbon tab):

The following events occur when a user clicks one of the outline buttons Spreadsheet - Outline Buttons to expand/collapse row or column groups:

The GroupStateChanging event fires before the expand/collapse operation starts. Enable the Cancel property of the event data class to cancel the operation. Event arguments allow you to determine whether a user expands or collapses groups (IsExpanding), check the group type (IsRowGroup), and retrieve information about affected groups (Groups).

The following code snippet prevents users from expanding row groups:

spreadsheetControl1.GroupStateChanging += (s, e) => {
    if (e.IsRowGroup && e.IsExpanding)
        e.Cancel = true;
};
See Also