windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-dot-setrowexpanded-x28-system-dot-int32-system-dot-boolean-system-dot-boolean-x29.md
Expands or collapses the specified group row and, optionally, the child group rows at all nesting levels.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public void SetRowExpanded(
int rowHandle,
bool expanded,
bool recursive
)
Public Sub SetRowExpanded(
rowHandle As Integer,
expanded As Boolean,
recursive As Boolean
)
| Name | Type | Description |
|---|---|---|
| rowHandle | Int32 |
An integer value identifying the group row by its handle.
| | expanded | Boolean |
true to expand the group row; false to collapse it.
| | recursive | Boolean |
true to expand/collapse child group rows at all nesting levels; false to preserve the expanded state of child group rows.
|
The SetRowExpanded method raises either the GridView.GroupRowExpanding or GridView.GroupRowCollapsing event. These events allow you to prevent the row from being expanded or collapsed respectively. If a row has been expanded or collapsed successfully, the GridView.GroupRowExpanded or GridView.GroupRowCollapsed event is raised respectively.
If the specified handle points to a data row, the method does nothing.
Please refer to the Working with Groups in Code topic for additional information.
Note
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the SetRowExpanded member must not be invoked for these Views. The SetRowExpanded 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 snippet (auto-collected from DevExpress Examples) contains a reference to the SetRowExpanded(Int32, Boolean, 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.
winforms-preserve-grid-state-on-refresh/CS/RefreshHelperClass.cs#L63
int parentRowHandle = FindParentRowHandle(rowInfo, dataRowHandle);
view.SetRowExpanded(parentRowHandle, true, false);
}
winforms-preserve-grid-state-on-refresh/VB/RefreshHelperClass.vb#L69
Dim parentRowHandle As Integer = FindParentRowHandle(rowInfo, dataRowHandle)
view.SetRowExpanded(parentRowHandle, True, False)
End If
See Also