GridView.SetMasterRowExpanded(Int32, Boolean) Method

Expands or collapses the specified master row.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v20.2.dll


public void SetMasterRowExpanded(
    int rowHandle,
    bool expand
Public Sub SetMasterRowExpanded(
    rowHandle As Integer,
    expand As Boolean


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 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