Version

RefreshSort() Method

Refreshes the sort order of the control's Nodes collection, and all of its descendant collections.
Syntax
'Declaration
 
Public Overloads Sub RefreshSort() 
public void RefreshSort()
Remarks

The UltraTree control will automatically refresh sorted nodes when the Sort or SortComparer property is changed or when a node's Text is modified. So it is not required to explicitly call the RefreshSort method in these cases. However, it may be necessary to call RefreshSort if a customer SortComparer is being used to sort on a property other than Text. For example, if sorting is being done on the Tag property of a node, the control will not refresh the sort when a Tag is changed. Calling RefreshSort will re-sort the nodes.

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