DxTreeViewBase.LoadChildNodesOnDemand Property

Specifies whether TreeView child nodes are loaded on demand.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.dll

Declaration

[Parameter]
public bool LoadChildNodesOnDemand { get; set; }

Property Value

Type Description
Boolean

true to load child nodes on demand; otherwise, false.

Remarks

When you enable Load Child Nodes on Demand mode (set the LoadChildNodesOnDemand property to true), the TreeView loads a node’s children when the node is expanded for the first time. This mode improves the TreeView's performance for tree structures with a large number of nodes.

NOTE

You can use the Load Child Nodes on Demand mode for bound and unbound TreeView nodes.

Bound TreeView in Load Child Nodes on Demand mode requires that you specify a lambda expression as the HasChildrenExpression property value. 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