Back to Devexpress

DxTreeView.HasChildrenExpression Property

blazor-devexpress-dot-blazor-dot-dxtreeview-44319443.md

latest2.3 KB
Original Source

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

NuGet Package : DevExpress.Blazor

Declaration

csharp
[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

TypeDescription
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

DxTreeView Class

DxTreeView Members

DevExpress.Blazor Namespace