[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
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Filtering and Searching
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
    [Expand]Binding to Data
    [Collapse]Hierarchical Data Presentation
      How to: Bind to Self-Referential Data Structure
      How to: Implement ChildNodesPath
      How to: Implement Hierarchical Data Binding via Child Nodes Selector
      How to: Build a Tree via HierarchicalDataTemplate
      How to: Manually Create a Tree (Unbound Mode)
      How to: Dynamically Load Nodes
      How to: Iterate Through Nodes via the Node Iterator
    [Expand]Sorting, Grouping and Filtering
    [Expand]Calculating Summaries
    [Expand]Data Editing and Validation
    [Expand]Focus and Navigation
    [Expand]Styles and Templates
    [Expand]End-User Interaction
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [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
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Implement Hierarchical Data Binding via Child Nodes Selector

A hierarchical data structure is any set of nested business objects that have a structure where the children of a node are in a childre__n field. Parents and children can be different object types. When working with hierarchical data structures, the control's ItemsSource property contains only data items that correspond to root nodes. The TreeListView provides two approaches (tree derivation modes) allowing you to specify where a data object's child items come from. This can be done using Hierarchical Data Templates or in code-behind via a Child Nodes Selector.This example shows how to build a tree in code-behind. The CustomChildrenSelector class implements DevExpress.Xpf.Grid.IChildNodeSelector and returns the list/collection of child nodes for the specified node. This selector is assigned to the TreeListView's ChildNodesSelector property. The TreeListView's TreeDerivationMode property should be set to ChildNodesSelector.

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