Skip to main content

GridView.SetMasterRowExpanded(Int32, Boolean) Method

Expands or collapses the specified master row.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v23.2.dll

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

Declaration

public void SetMasterRowExpanded(
    int rowHandle,
    bool expand
)

Parameters

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.

Remarks

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.

Note

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.

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetMasterRowExpanded(Int32, Boolean) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also