Skip to main content

DxTreeView.HasChildrenExpression Property

OBSOLETE

This property is obsolete now. Add the DataMappings tag to markup, define a collection of DxTreeViewDataMapping items, and map item properties to data source fields instead.

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Browsable(false)]
[Obsolete("This property is obsolete now. Add the DataMappings tag to markup, define a collection of DxTreeViewDataMapping items, and map item properties to data source fields instead.")]
[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)
    };
}
See Also