Flexible TreeView Flexible TreeView


Support & Community

Parent & Sibling nodes

Previous Table of Contents Next

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:

  • Root – root node of a treeview to which this node is bound;
  • Parent – node`s parent node. Returns NULL for all root-level nodes;
  • RealParent – identical to the Parent, but returns the treeview`s Root node for all root-level nodes;
  • Nodes – children nodes list;
  • AttachTo(parentNode) – add the node to the specified parent node.

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.

Node index


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.

Node level


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;


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;


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.

Previous Top Next


Last news
Bookmark and Share
Use Flexible TreeView in WPF project
Sunday, 18 December 2011

Do you have a WPF project and want to use Flexible TreeView there? No problem!

Flexible TreeView v3.4
Friday, 16 December 2011

Flexible TreeView v3.4 maintenance release has been released.

Flexible TreeView v3.3
Friday, 23 September 2011

Flexible TreeView v3.3 maintenance release has been released. Separate assemblies for .NET 2.0, 4.0 and 4.0 Client Profile, HTML markup extension, etc.

Latest release

Version:
Release date:
3.4
Dec 16, 2011


Copyright © 2006-2012 ARMSoft. All rights reserved.