MyTree.ActiveNode = MyTree.Nodes(0).Nodes(0)
The xamDataTree™ control supports activation of its nodes. A node is considered to be active if it is the current node focus. Only one node can be active at any given time. Activation is implemented on the xamDataTree control so that actions that can only be executed on a single node, such as editing, can be performed.
Activation Using the Keyboard
If the xamDataTree control does not have an active item, and the tree receives focus, then the first node in the tree will become active. Once there is an active node in the tree, your end user can navigate through the tree using the arrow keys.
The following table lists all the keys that can be used to interact with the xamDataTree control.
Activation with Code
You can get or set the active node using the xamDataTree control’s ActiveNode property, as demonstrated by the following code snippet.
In Visual Basic:
MyTree.ActiveNode = MyTree.Nodes(0).Nodes(0)
In C#:
MyTree.ActiveNode = MyTree.Nodes[0].Nodes[0];
You can also set an active node using the Node’s IsActive property. The following code demonstrates how to achieve this.
In Visual Basic:
MyTree.Nodes(0).Nodes(0).IsActive = True
In C#:
MyTree.Nodes[0].Nodes[0].IsActive = true;
Related Topics