Back to Devexpress

TreeList.Nodes Property

windowsforms-devexpress-dot-xtratreelist-dot-treelist-97eaaba1.md

latest4.8 KB
Original Source

TreeList.Nodes Property

Provides access to the collection of the TreeList’s root nodes.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[Browsable(true)]
public TreeListNodes Nodes { get; }
vb
<Browsable(True)>
Public ReadOnly Property Nodes As TreeListNodes

Property Value

TypeDescription
TreeListNodes

The collection of root nodes.

|

Remarks

The Nodes returns a collection of the control’s root nodes. Every node can have child nodes which can be accessed with the TreeListNode.Nodes property. In turn, child nodes refer to their parents via the TreeListNode.ParentNode property.

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.

winforms-treelist-sync-position-of-nodes-with-data-records/CS/Q351285/Form1.cs#L21

csharp
treeList1.ForceInitialize();
UpdateNodesPositions(treeList1.Nodes);
treeList1.ExpandAll();

winforms-treelist-copy-nodes-to-another-treelist/CS/CopyNodesExample/MainForm.cs#L28

csharp
private void CopyButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
    foreach (TreeListNode node in treeList1.Nodes) {
        CopyNodeWithChildren(node, treeList2.Nodes);

drag-drop-grid-rows-to-treelist/CS/DragAndDropRows/Form1.cs#L103

csharp
return -1000;
var nodes = destNode.ParentNode == null ? treeList.Nodes : destNode.ParentNode.Nodes;
int index = nodes.IndexOf(destNode);

winforms-treelist-sync-position-of-nodes-with-data-records/VB/Q351285/Form1.vb#L27

vb
treeList1.ForceInitialize()
UpdateNodesPositions(treeList1.Nodes)
treeList1.ExpandAll()

winforms-treelist-copy-nodes-to-another-treelist/VB/CopyNodesExample/MainForm.vb#L31

vb
Private Sub CopyButtonItem_ItemClick(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
    For Each node As TreeListNode In treeList1.Nodes
        CopyNodeWithChildren(node, treeList2.Nodes)

drag-drop-grid-rows-to-treelist/VB/DragAndDropRows/Form1.vb#L99

vb
If e.InsertType = InsertType.AsChild Then Return -1000
Dim nodes = If(destNode.ParentNode Is Nothing, treeList.Nodes, destNode.ParentNode.Nodes)
Dim index As Integer = nodes.IndexOf(destNode)

See Also

GetNodeList()

NodesIterator

Nodes

IsRootNode(TreeListNode)

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace