Version

GetSibling Method

Gets the specified sibling of the UltraTreeNode.
Syntax
'Declaration
 
Public Function GetSibling( _
   ByVal nodePosition As NodePosition _
) As UltraTreeNode
public UltraTreeNode GetSibling( 
   NodePosition nodePosition
)

Parameters

nodePosition
Specifies which sibling to get relative to the node.

Return Value

A reference to the UltraTreeNode or Nothing if there is no matching sibling.
Remarks

To determine if an UltraTreeNode has a Next/Previous sibling, use the HasSibling method.

Example
The following sample code illustrates how to calculate the number of nodes in a tree.

Imports Infragistics.Win.UltraWinTree

Private Sub button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button18.Click

    Dim totalNodesInTree As Integer
    Dim nonRootNodes As Integer
    Dim node As UltraTreeNode

    ' Call the tree control's 'GetNodeCount' method 
    ' with true to get the total numder of nodes
    ' in the tree.
    totalNodesInTree = Me.ultraTree1.GetNodeCount(True)

    Debug.WriteLine("Total nodes in tree = " + totalNodesInTree.ToString())
    Debug.Indent()

    ' Get the first root node
    node = Me.ultraTree1.Nodes(0)

    While Not node Is Nothing
        ' Add in root node's descendant nodes.
        nonRootNodes += node.GetNodeCount(True)

        ' Get the next root node
        node = node.GetSibling(NodePosition.Next)
    End While

    Debug.WriteLine("root nodes = " + Me.ultraTree1.Nodes.Count.ToString())
    Debug.WriteLine("non-root nodes = " + nonRootNodes.ToString())
    Debug.IndentLevel = 0

End Sub
using System.Diagnostics;
using Infragistics.Win.UltraWinTree;

private void button18_Click(object sender, System.EventArgs e)
{

	// Call the tree control's 'GetNodeCount' method 
	// with true to get the total numder of nodes
	// in the tree.
	int totalNodesInTree = this.ultraTree1.GetNodeCount( true );

	Debug.WriteLine( "Total nodes in tree = " + totalNodesInTree.ToString());
	Debug.Indent();

	int nonRootNodes = 0;

	// Get the first root node
	UltraTreeNode node = this.ultraTree1.Nodes[0];

	while ( node != null )
	{
		// Add in root node's descendant nodes.
		nonRootNodes += node.GetNodeCount(true);

		// Get the next root node
		node = node.GetSibling( NodePosition.Next );
	}

	Debug.WriteLine( "root nodes = " + this.ultraTree1.Nodes.Count.ToString() );
	Debug.WriteLine( "non-root nodes = " + nonRootNodes.ToString());
	Debug.IndentLevel = 0;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also