wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-ad7e4b3a.md
Gets the collection of root nodes.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
[Browsable(false)]
public TreeListNodeCollection Nodes { get; }
<Browsable(False)>
Public ReadOnly Property Nodes As TreeListNodeCollection
| Type | Description |
|---|---|
| TreeListNodeCollection |
A TreeListNodeCollection object that contains root nodes.
|
To iterate through the nodes, do the following.
Create a new instance of the TreeListNodeIterator class. Multiple constructors allow you to specify a start node or a collection of nodes, along with whether to process only visible nodes.
Use the TreeListNodeIterator.MoveNext method to iterate through nodes. The TreeListNodeIterator.Current property returns the processed node. Each time the TreeListNodeIterator.MoveNext method is called, the Node Iterator moves to the next node in the hierarchy and updates the TreeListNodeIterator.Current property. If the current node is the last node, the TreeListNodeIterator.MoveNext method returns false.
To learn more, see Nodes and Binding to Self-Referential Data Structure.
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.
var grid = this.AssociatedObject;
this.AttachItems((grid.View as TreeListView).Nodes);
void SmartExpandNodes(int minChildCount) {
TreeListNodeIterator nodeIterator = new TreeListNodeIterator(view.Nodes, true);
while (nodeIterator.MoveNext())
Dim grid = Me.AssociatedObject
Me.AttachItems((TryCast(grid.View, TreeListView)).Nodes)
See Also