TreeListNode.Nodes Property
Gets the collection of the node’s children.
Namespace: DevExpress.XtraTreeList.Nodes
Assembly: DevExpress.XtraTreeList.v22.2.dll
NuGet Package: DevExpress.Win.TreeList
Declaration
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);