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.MasterRowCollapsed Event

Fires immediately after a detail clone has been destroyed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.2.dll

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

#Declaration

[DXCategory("MasterDetail")]
public event CustomMasterRowEventHandler MasterRowCollapsed

#Event Data

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

Property Description
RelationIndex Gets the relation index that identifies the affected detail.
RowHandle Gets the handle of the currently processed master row in the current View.

#Remarks

Details become visible as they are dynamically created. For instance, when expanding a master row, the detail is created just before displaying it. When switching to other detail(s), they are created as required. This means that a master row can have several details but only a few of them (or a single one) may have been created.

The MasterRowCollapsed event fires when collapsing a master row (thus destroying its details). It is raised for each existing detail being destroyed (thus this may not be all details owned). The master row is identified by the CustomMasterRowEventArgs.RowHandle parameter. The detail being destroyed is identified by the CustomMasterRowEventArgs.RelationIndex parameter.

The MasterRowCollapsed event serves only as a notification and you cannot cancel the action. To specify whether particular master rows can be collapsed, handle the GridView.MasterRowCollapsing event instead.

Note: each time a detail clone is destroyed, the grid control’s GridControl.ViewRemoved event is raised. Handle that event if you need to manage the state of all Views within the grid control. If you only need to respond to destroying a View’s immediate children, handle the master View’s MasterRowCollapsed event instead.

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

See Also