BaseRow.Expanded Property
Gets or sets a value specifying whether the current row is expanded.
Namespace: DevExpress.XtraVerticalGrid.Rows
Assembly: DevExpress.XtraVerticalGrid.v22.2.dll
NuGet Package: DevExpress.Win.VerticalGrid
Declaration
[DefaultValue(true)]
[DXCategory("Appearance")]
[XtraSerializableProperty]
public virtual bool Expanded { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | true | true if the current row is expanded; otherwise false. |
Remarks
The Expanded property is only for parent rows (i.e. for rows containing child rows). You can determine whether a particular row has children by using the BaseRow.HasChildren property. Set a parent’s row Expanded property to true to display its child rows. If set to false, the current parent row is collapsed and its child rows hidden.
Example
The following sample code expands all collapsed parent rows at the root level and collapses expanded ones. The BaseRow.Expanded
property is used for this purpose. The collection of root level rows is accessed via the VGridControlBase.Rows property. The BaseRow.HasChildren property is used to determine whether a row is a parent one and can be expanded or collapsed.
The image below displays the look & feel of a grid control before and after execution of the sample code.
foreach (BaseRow currRow in vGridControl1.Rows) {
// collapsing expanded parent rows or expanding collapsed ones
if (currRow.HasChildren) currRow.Expanded = !currRow.Expanded;
}