Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpreadsheetControl.GroupStateChanging Event

Fires before row or column groups are expanded or collapsed.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.Wpf.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 WPF 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