New to Telerik UI for Blazor? Download Free 30-day trial
TreeView - Hierarchical Data
- EDIT IN TELERIK REPL
- Change Theme
Telerik UI for Blazor TreeView displays data in a tree-like structure. It allows you to navigate through the items and their children. One of the main ways to provide data to TreeView is using hierarchical data.
The component rendering stays the same regardless of the data type. Yet, its configuration will be different when using hierarchical or flat data. The current demo targets data binding to hierarchical data.
The hierarchical data means that the collection of child items is provided in a field of its parent's model, unlike when using flat data. That is the
Items field by default. If a given node has items, an expand icon will be visible. The
HasChildren field can override this, yet - it is not required for hierarchical data binding.
The above approach of providing nodes lets you gather separate collections of data and/or use different models at each level. The data binding settings are per level, so a certain level will always use the same bindings, regardless of the model they represent and their parent.
You can also take a look at the Treeview data binding basics.
The demo above demonstrates a Telerik Blazor TreeView component that uses hierarchical data. The parent-child relationship is created through the