Version

Change the Active Node

This topic will show you how to change the ActiveNode programmatically.

  1. Before you start writing any code, you should place using/imports directives in your code-behind so you don’t need to always type out a member’s fully qualified name.

In Visual Basic:

Imports Infragistics.Win.UltraWinTree

In C#:

using Infragistics.Win.UltraWinTree;
  1. You will need a reference to the node that you want to make active. If you know the key of the node, you can get a reference using the GetNodeByKey method of the tree.

In Visual Basic:

Private Sub Change_the_Active_Node_Load(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles MyBase.Load
	Dim aNode As UltraTreeNode
	aNode = Me.UltraTree1.GetNodeByKey("Add Unbound Columns to WinGrid")
End Sub

In C#:

private void Change_the_Active_Node_Load(object sender, EventArgs e)
{
	UltraTreeNode aNode;
	aNode = this.ultraTree1.GetNodeByKey("Add Unbound Columns to WinGrid");
}
  1. Once you have a reference to the node, you can set the ActiveNode property of the tree to that node.

In Visual Basic:

Me.UltraTree1.ActiveNode = aNode

In C#:

this.ultraTree1.ActiveNode = aNode;