Version

Reposition(TreeNodesCollection) Method

Repositions the node to a new parent adds it to the end of the TreeNodesCollection.
Syntax
'Declaration
 
Public Overloads Sub Reposition( _
   ByVal newNodesCollection As TreeNodesCollection _
) 
public void Reposition( 
   TreeNodesCollection newNodesCollection
)

Parameters

newNodesCollection
The TreeNodesCollection to which this node will move.
Remarks

A node can be positioned to any other TreeNodesCollection in the same tree or even a different UltraTree control.

Note: All of the descendants of the node will move along with it.

Note: A node cannot be repositioned to one of it's own Descendants.

Example
The following sample code illustrates how to change the position of nodes within a tree.

Imports Infragistics.Win.UltraWinTree

Private Sub button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button17.Click

    Dim node As UltraTreeNode

    node = Me.ultraTree1.ActiveNode

    If node Is Nothing Then Return

    ' Check if the active node is a root node.
    If node.IsRootLevelNode Then
        ' If the node is the first root level node
        ' make it the last. Otherwise make it the first.
        If node.Index = 0 Then
            node.Reposition(node, NodePosition.Last)
        Else
            node.Reposition(node, NodePosition.First)
        End If
    Else
        ' Reposition the node by appending it to
        ' the root nodes collection
        node.Reposition(Me.ultraTree1.Nodes)

        ' If the root nodes collection is sorted then
        ' re-sort it so that the repositioned node 
        ' is slotted appropriately.
        If Not Me.ultraTree1.Nodes.SortResolved = SortType.None Then
            Me.ultraTree1.RefreshSort(Me.ultraTree1.Nodes, False)
        End If
    End If

End Sub
using Infragistics.Win.UltraWinTree;

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

	UltraTreeNode node = this.ultraTree1.ActiveNode;

	if ( node == null )
		return;

	// Check if the active node is a root node.
	if ( node.IsRootLevelNode )
	{
		// If the node is the first root level node
		// make it the last. Otherwise make it the first.
		if ( node.Index == 0 )
			node.Reposition( node, NodePosition.Last );
		else
			node.Reposition( node, NodePosition.First );
	}
	else
	{
		// Reposition the node by appending it to
		// the root nodes collection
		node.Reposition( this.ultraTree1.Nodes );

		// If the root nodes collection is sorted then
		// re-sort it so that the repositioned node 
		// is slotted appropriately.
		if ( this.ultraTree1.Nodes.SortResolved != SortType.None )
			this.ultraTree1.RefreshSort(this.ultraTree1.Nodes, false );
	}

}
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