GridView.CollapseMasterRow(Int32, Int32) Method
Collapses a specific detail View which belongs to the specific master row.
NuGet Package: DevExpress.Win.Grid
public void CollapseMasterRow( int rowHandle, int relationIndex )
Public Sub CollapseMasterRow( rowHandle As Integer, relationIndex As Integer )
The handle of the master row to collapse.
A zero-based integer specifying the index of the relationship in the data source.
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.
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.
- GridControl.MainView - returns the top most View in a grid;
- GridControl.FocusedView - returns the focused View;
- GridControl.DefaultView - returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView - returns a detail clone View for a specific master row.