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
   [Expand]Feature Center
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Collapse]Data Binding
      How to: Create Nodes in Unbound Mode at Design Time
      How to: Create Nodes in Unbound Mode in Code
      How to: Implement a Tree Structure for a Business Object
      How to: Implement Virtual Mode (Dynamic Loading) in Unbound Mode
      How to: Load Data Dynamically via Events
    [Expand]Nodes
    [Expand]Data Editing
    [Expand]Data Representation
    [Expand]Sorting
    [Expand]Summaries
    [Expand]Appearance
    [Expand]Focus and Selection
    [Expand]Miscellaneous
     How to: Drag XtraGrid rows to the XtraTreeList
     How to: Dynamically Show and Hide Specific Nodes
     How to: Format a Column's Numeric Values as Currency
     How to: Hide specific nodes using filter conditions
   [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]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Implement a Tree Structure for a Business Object

The Virtual Mode by Binding to a Business Object topic covers information on binding a Tree List control to a business object. If the business object implements the IVirtualTreeListData, the Tree List control will dynamically create nodes based on the data stored in the object.

The following example shows how to implement a tree structure for a business object.

In the example, a custom MyData class will support the IVirtualTreeListData interface allowing objects of this class to be represented in a TreeList. The object implements all three methods of the interface.

  • VirtualTreeGetChildNodes - returns lists of root or child nodes.
  • VirtualTreeGetCellValue - returns values for node cells.
  • VirtualTreeSetCellValue - saves the changes made by an end-user to the object.

The MyData class is implemented as follows.

The following code creates an object of the MyData class, representing a data source for the Tree List control, populates it with nodes and binds to the TreeList.

The image below illustrates the result.

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