[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Property Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
      Using the Nodes Iterator
      Custom Nodes
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst 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]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)

Custom Nodes

Custom nodes, which are TreeListNode descendants, allow you to extend the default node capabilities. This topic shows how to create custom nodes and use them in a Tree List control.

Expanded Custom Nodes

Nodes of the Tree List control (TreeListNode objects) are not created directly. The Tree List control doesn't call the TreeListNode constructor. Instead, it calls the protected CreateNode method each time a new node needs to be created. This method has the following syntax:

protected virtual TreeListNode CreateNode(int nodeID, TreeListNodes owner);

This method must return the newly created node. The nodeID and owner parameters specify the node's identifier and the owning collection. The first parameter corresponds to the TreeListNode.Id property. The second parameter is the parent node's TreeListNode.Nodes property value. (If a root level node is created, the owner parameter is equal to the TreeList.Nodes property value.)

The following technique allows you to create custom nodes:

  • Create a TreeListNode descendant with the required functionality.
  • Create a TreeList control descendant, and override the CreateNode method, to return a newly created node of a custom type.
  • Add the derived control to the form.

Expanded Example

This example shows how to create a custom node class that introduces a Height property. This property will allow heights to be set for individual nodes.

See the CustomTreeListNode module in the following tutorial demo for another example:

C:\Users\Public\Documents\DevExpress Demos 18.2\Components\WinForms\CS\TreeListTutorials\

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