Skip to main content

GridView.SetMasterRowExpanded(Int32, Boolean) Method

Expands or collapses the specified master row.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v22.1.dll

NuGet Package: DevExpress.Win.Grid


public void SetMasterRowExpanded(
    int rowHandle,
    bool expand


Name Type Description
rowHandle Int32

An integer value identifying the master row by its handle.

expand Boolean

true to expand the specified row; false to collapse it.


If the expand parameter is set to true, the method expands the row making the default detail visible. The default detail is identified by the GridView.DefaultRelationIndex property value. Note that if the master row is already expanded, the method does nothing (it will not switch to the default detail if another detail is already visible). If you need to make a different detail visible, use the GridView.SetMasterRowExpandedEx method instead.

The GridOptionsDetail.AllowExpandEmptyDetails option controls whether empty details can be expanded. If this option is set to false and the default detail is empty, the SetMasterRowExpanded method will not expand this detail. Instead, the first non-empty detail will be expanded.

If the expand parameter is set to false, the method collapses the master row destroying all details. Note that the GridView.CollapseMasterRow method can be used for the same purpose.

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


Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the SetMasterRowExpanded member must not be invoked for these Views. The SetMasterRowExpanded 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