Back to Devexpress

BaseRow.HasChildren Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-rows-dot-baserow-0402dda1.md

latest3.0 KB
Original Source

BaseRow.HasChildren Property

Gets a value indicating whether a specific row contains child rows.

Namespace : DevExpress.XtraVerticalGrid.Rows

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
[Browsable(false)]
public virtual bool HasChildren { get; }
vb
<Browsable(False)>
Public Overridable ReadOnly Property HasChildren As Boolean

Property Value

TypeDescription
Boolean

true if a specific row contains one or more child rows; otherwise false.

|

Remarks

Use this property to determine whether the current row has child rows. If the row’s BaseRow.ChildRows collection is not empty, the HasChildren property will return true.

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.

csharp
foreach (BaseRow currRow in vGridControl1.Rows) {
    // collapsing expanded parent rows or expanding collapsed ones
    if (currRow.HasChildren) currRow.Expanded = !currRow.Expanded;
}
vb
Dim CurrRow As BaseRow
For Each CurrRow In VGridControl1.Rows
' collapsing expanded parent rows or expanding collapsed ones
    If CurrRow.HasChildren Then CurrRow.Expanded = Not CurrRow.Expanded
Next

See Also

ChildRows

HasAsChild(BaseRow)

BaseRow Class

BaseRow Members

DevExpress.XtraVerticalGrid.Rows Namespace