Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Collapse]Data Binding
      Bound Mode
      Tree Generation Algorithm in the Tree List
      Virtual Mode (Dynamic Data Loading) Using Events
      Virtual Mode by Binding to a Business Object
      Unbound Mode
      Unbound Columns
      Posting Data to a Connected Database in ADO.NET
    [Expand]Nodes
    [Expand]Data Editing
    [Expand]Data Representation
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Summaries
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
    [Expand]Miscellaneous
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Tree Generation Algorithm in the Tree List

The Tree List allows you to display information in a tree structure. In this mode, data is presented as in a tree view. This can be useful if you are going to present data that comprises any hierarchy. If data for a Tree List control is acquired from a data source, the data must meet certain requirements. Two additional fields are necessary to build a tree structure. The first field must contain unique values and must be assigned to the TreeList.KeyFieldName. The second field contains values that indicate parent nodes for the current node and it must be assigned to the TreeList.ParentFieldName property.

Here is an example of such a data source. Key field values are stored in the ID column, while parent key field values are stored in the PARENTID column:

This image shows parent-child relationships between records. Here, the "Corporate Headquarters" will represent a node displayed at the root level in the Tree List control. Other records will be represented as children of this and other nodes.

Root nodes do not have parent nodes. However, for all data source records representing root nodes the parent key field must be set to a certain unique value. This value must be assigned to the TreeList.RootValue property. In the example, the PARENTID field value for the "Corporate Headquarters" record is set to 0. This value is also assigned to the TreeList.RootValue property.

Binding the data source shown in the image above to the Tree List control, setting the TreeList.KeyFieldName property to "ID", and the TreeList.ParentFieldName property to "PARENTID", results in the following:

The fields assigned to the TreeList.KeyFieldName and TreeList.ParentFieldName properties are assumed to be service fields. When the Tree List control is bound to a data source, Tree List columns corresponding to the service fields are not created by default. To create these columns, enable the TreeListOptionsBehavior.PopulateServiceColumns option, and then repopulate the Tree List column collection (for instance via the Tree List Designer). The following image shows the same Tree List control with visible service columns:

How would you rate this topic?​​​​​​​