Skip to main content
A newer version of this page is available. .

DxTreeView.HasChildrenExpression Property

A lambda expression that specifies whether the data item has child items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<object, bool>> HasChildrenExpression { get; set; }

Property Value

Type Description
Expression<Func<Object, Boolean>>

A lambda expression that returns a Boolean value: true if the data item has child items; otherwise, false.

Remarks

Use the HasChildrenExpression property in the Load Child Nodes on Demand mode to specify a lambda expression that indicates whether the data item has child items. The TreeView uses this property to render nodes before they are expanded for the first time.

<DxTreeView Data="@DataSource"
            LoadChildNodesOnDemand="true"
            HasChildrenExpression="@(dataItem => ((DateTimeGroup)dataItem).HasSubGroups)"
            ChildrenExpression="@(dataItem => ((DateTimeGroup)dataItem).GetSubGroups())"
            TextExpression="@(dataItem => ((DateTimeGroup)dataItem).Title)">
</DxTreeView>

@code {
    IEnumerable<DateTimeGroup> DataSource = new List<DateTimeGroup>() {
        new DateTimeGroup(new DateTime(DateTime.Now.Year, 1, 1), DateTimeGroupType.Year)
    };
}

Run Demo: TreeView - Load Child Nodes on Demand Mode

See Also