[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Collapse]Binding to Data
     Binding to Data Overview
     Binding to ICollectionView
    [Expand]Server Mode
    [Expand]Binding to any Data Source with Virtual Sources
    [Collapse]TreeListView Data Binding
      Binding to Hierarchical Data Overview
      Binding to Self-Referential Data Structure
      Binding to Hierarchical Data Structure
      TreeList View Unbound Mode
      Dynamic Data Loading
     Applying Data Annotations
     Unbound Columns
     Posting Data to a Connected Database
     Managing Multi-Thread Data Updates
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Selection
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Drag-and-Drop
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Binding to Hierarchical Data Overview

In data bound mode, the TreeListView can display information in a tree from a self-referential (flat) or hierarchical data structure. It provides the corresponding tree derivation mode(s), specified via the TreeListView.TreeDerivationMode property, for each type of a data structure:

Data Structure Type

Tree Derivation Mode

Self-Referential (Flat)

Example: Table

Self-Reference

Hierarchical

Example: Business Class Structure

Child Nodes Path

Child Nodes Selector

Hierarchical Data Template

Expanded Self-Referential Data Structure

The TreeListView can display information in a tree from self-referential data structures. To build a tree structure, data source should contain two fields with the same data type.

  • Key Field

    This field must contain unique values used to identify nodes.

  • Parent Field

    This field must contain values that indicate parent nodes.

The image below illustrates how the TreeListView generates a tree based on Key-Parent pairs:

Topic:Binding to Self-Referential Data Structure

Expanded Hierarchical Data Structure

A hierarchical data structure is any set of nested business objects that have a structure where the children of a node are in a ‘children' field. Parents and children can be different object types.

  • ChildNodesPath - use this approach with the same object type for a child and parent fields only.
  • ChildNodesSelector - create a selector class for picking fields. This approach is applicable for a different objects types.
  • Hierarchical Data Templates - create a template for different data types.

Topic:Binding to Hierarchical Data Structure

Expanded Examples

Is this topic helpful?​​​​​​​