Flexible TreeView 5.1.9 Help
Parent & sibling nodes

To show a node inside the treeview, you need to add that node to the treeview's Root node or any other parent node within that treeview.
To control nodes hierarchy, use these node properties and methods:

To check whether a node is attached to the treeview, use the IsAttached property.


Index

Every node has its own zero-based unique index within the parent's children nodes that is stored in the Index property. By changing it, you'll move the node within the current parent.


Level

Every node has its own nesting level that is stored in the Level property. It defines how deep the node is in the treeview nodes' hierarchy. Root-level nodes has the value 0, root node's children - 1 and so on.


Path

A node may have unlimited nesting level. To get all of a node's parents, use the Path property. It contains the FullPath property, which returns a node's parents list with the node itself as the first item in the list. Also, you can use the Parents path property, which returns only the node's parents list.

Example:

Node n1 = new Node("1");
Node n2 = new Node("2");
n2.AttachTo(n1);
Node n3 = new Node("3");
n3.AttachTo(n2);
 
//  returns: n1, n2, n3.
Node[] hierarchy = n3.Path.FullPath;
 
//  returns: n1, n2.
hierarchy = n3.Path.Parents;
Dim n1 As New Node(1)
Dim n2 As New Node(2)
n2.AttachTo(n1)
Dim n3 As New Node(3)
n3.AttachTo(n2)

'  returns: n1, n2, n3.
Dim hierarchy As Node() = n3.Path.FullPath

'  returns: n1, n2.
hierarchy = n3.Path.Parents

RealParent

To optimize work with a node's parent nodes, every node has two properties - Parent and RealParent. While the Parent property returns NULL for root-level nodes, RealParent always return a not-NULL for every node. For root nodes, it returns the treeview's Root node.


TopLevelParent

To find a node's top most parent, use the TopLevelParent property.

Example:

Node n1 = new Node("1");
Node n2 = new Node("2");
n2.AttachTo(n1);
Node n3 = new Node("3");
n3.AttachTo(n2);
//  topParent = n1
Node topParent = n3.TopLevelParent;
Dim n1 As New Node(1)
Dim n2 As New Node(2)
n2.AttachTo(n1)
Dim n3 As New Node(3)
n3.AttachTo(n2)
'  topParent = n1
Dim topParent As Node = n3.TopLevelParent

NextSiblingNode, PrevSiblingNode

If you have a node instance, you can find the next or previous sibling node within the current parent using the NextSiblingNode and PrevSiblingNode node properties respectively.


NextExpandedNode, PrevExpandedNode

The NextExpandedNode and PrevExpandedNode properties are almost equivalent to the NextSiblingNode and PrevSiblingNode properties, but allows you to get visible sibling nodes within the whole treeview.

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com