Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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.

Razor
<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