Skip to main content

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

GridView.MasterRowCollapsing Event

Enables you to control whether master rows can be collapsed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

[DXCategory("MasterDetail")]
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.

#Remarks

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