Skip to main content

GridView.MasterRowCollapsing Event

Enables you to control whether master rows can be collapsed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public event MasterRowCanExpandEventHandler MasterRowCollapsing

Event Data

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

Property Description
Allow Gets or sets a value specifying whether the current operation is allowed.
RelationIndex Gets the relation index that identifies the affected detail. Inherited from CustomMasterRowEventArgs.
RowHandle Gets the handle of the currently processed master row in the current View. Inherited from CustomMasterRowEventArgs.


The MasterRowCollapsing event is raised when attempting to collapse a master row. The master row can be identified using the event’s CustomMasterRowEventArgs.RowHandle parameter. If you need to prohibit row collapsing, set the MasterRowCanExpandEventArgs.Allow parameter to false. Note that the MasterRowCollapsing event is raised for each expanded master row when the GridView.CollapseAllDetails method is called. This enables you to control which master rows should be collapsed.

Note: the event’s CustomMasterRowEventArgs.RelationIndex parameter always returns -1. This tells you that the master row is affected as a whole rather than just an individual detail.

Please refer to the Master-Detail Relationships topic for additional information.

See Also