Skip to main content

TreeListNode.Nodes Property

Gets the collection of the node’s children.

Namespace: DevExpress.XtraTreeList.Nodes

Assembly: DevExpress.XtraTreeList.v23.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

[Browsable(false)]
public virtual TreeListNodes Nodes { get; }

Property Value

Type Description
TreeListNodes

A TreeListNodes object representing the node’s child nodes collection.

Remarks

Nodes of the Tree List control are represented in a tree-like structure. This implies that each node can have a number of child nodes. Each child can have its own child nodes collection, etc. This collection can be accessed via the Nodes property of a node. The collection of root nodes can be obtained by reading the TreeList.Nodes property value.

The Nodes property returns the TreeListNodes object whose properties and methods can be used to add, delete and access individual nodes within the collection.

The organization of nodes described above implies that you must write recursive code to traverse through all nodes. However, the Tree List control allows you to avoid writing such code. It provides a nodes iterator that can be used to visit each node of the predefined set and perform the specified operation on them. Please refer to the TreeList.NodesIterator property description for details on using the iterator.

Example

The code below selects all nodes located at the second nesting level (root node children).

treeList1.BehaviorOptions |= BehaviorOptionsFlags.MultiSelect;
ArrayList al = new ArrayList();
for (int i = 0; i < treeList1.Nodes.Count; i++) {
   IEnumerator en = treeList1.Nodes[i].Nodes.GetEnumerator();
   while(en.MoveNext())
      al.Add(en.Current);
}
treeList1.Selection.Set(al);

The following code snippets (auto-collected from DevExpress Examples) contain references to the Nodes property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also