Skip to main content

GridView.CollapseMasterRow(Int32, Int32) Method

Collapses a specific detail View which belongs to the specific master row.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v23.2.dll

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

Declaration

public void CollapseMasterRow(
    int rowHandle,
    int relationIndex
)

Parameters

Name Type Description
rowHandle Int32

The handle of the master row to collapse.

relationIndex Int32

A zero-based integer specifying the index of the relationship in the data source.

Remarks

When the grid displays a several master-detail relationships, you can expand or collapse the specific detail Views using the CollapseMasterRow method. If master row contains only one detail View, the method collapses the master row, else the method displays the next existing detail View belonging to this master row.

Also the specific detail View can be collapsed by calling the GridView.SetMasterRowExpandedEx method with a boolean parameter set to false.

When the relation index is set to -1, the CollapseMasterRow method collapses all opened detail Views, which belong to the specified master row. To perform the same action you can call another overload of the CollapseMasterRow method with one parameter, specifying the master row to collapse.

Before the master row is collapsed, the GridView.MasterRowCollapsing event occurs. Handle this event to prevent the collapse of a specific master row. After the master row has collapsed, the GridView.MasterRowCollapsed event fires.

To collapse all opened detail Views, use the GridView.CollapseAllDetails method.

Note

Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the CollapseMasterRow member must not be invoked for these Views. The CollapseMasterRow member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.

See Also