Skip to main content
A newer version of this page is available. .

GridView.MasterRowCollapsed Event

Fires immediately after a detail clone has been destroyed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v19.2.dll

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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MasterRowCollapsed event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also