'Declaration Public Overloads Sub Reposition( _ ByVal newNodesCollection As TreeNodesCollection, _ ByVal index As Integer _ )
public void Reposition( TreeNodesCollection newNodesCollection, int index )
Repositioning a node by Index will ensure that the node ends up at the Index specified. Because of this, depending on whether the node moves up or down, it may end up in a different position relative to it's siblings. Therefore, this override of the Reposition method should not be used to position a node relative to another node. To position a node relative to another node, use Reposition(UltraTreeNode,NodePosition)
Note: A node cannot be repositioned to one of it's own Descendants.
Note: All of the descendants of the node will move along with it.
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 ); } }
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