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
    [Expand]Data Binding
    [Collapse]Nodes
      Node Objects
      Node Structure
      Using the Nodes Iterator
      Custom 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

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

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T419316.

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.

Please see the CustomTreeListNode tutorial project, for another example of creating custom nodes.

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