Skip to main content

Nodes Overview

  • 3 minutes to read

Nodes correspond to records in a data source and are TreeListNode objects.

TreeListView

Nodes are stored as nested collections because the TreeListView displays data in a tree. The collection of root level nodes can be accessed via the TreeListView.Nodes property. Each node has its own collection of child nodes available via the TreeListNode.Nodes property. These child nodes have their own children, etc.

In bound mode, nodes are created automatically for every record in a data source. In unbound mode, you need to create nodes.

Node Elements

A node includes the following elements:

The following image displays node elements:

Node

Root Nodes

Root nodes do not have parent nodes. The parent value of a root node does not point to a key value of any other node. Root nodes are contained within the TreeListView.Nodes collection.

Treelist Levels

Use theTreeListView.RootValue to specify the root value explicitly, for example, to build a tree from a specific hierarchy level. When this property is set (null is the default value), the root node collection includes only nodes whose parent values match the root value. Nodes whose parent values do not reference any other node are ignored and are not displayed in the tree.

The following example shows how to modify the tree shown above to display data from a specific hierarchy level. To do this, set TreeListView.RootValue to 1. Because the service fields store integer values, the value assigned to this property must also be an integer.

<dxg:TreeListView Name="treeListView"
                  KeyFieldName="ID" 
                  ParentFieldName="ParentID">
    <dxg:TreeListView.RootValue>
        <sys:Int32>1</sys:Int32>
    </dxg:TreeListView.RootValue>
</dxg:TreeListView>

The following image displays the result:

treelist-rootvalue

Concepts

Examples