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.v20.2.dll

Declaration

public void CollapseMasterRow(
    int rowHandle,
    int relationIndex
)
Public Sub CollapseMasterRow(
    rowHandle As Integer,
    relationIndex As Integer
)

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 real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

See Also