I'm using this code to find an existing node it the tree. I want the found node to appear selected/blue to the user, just as if the user clicked it with the mouse. Once this code executes, the UltraTree.SelectedNodes collection contains the node that I set UltraTreeNode.Selected, but the node still does not appear blue to the user.
What am I doing wrong?
this._tree.SelectedNodes.Clear(); this._tree.CollapseAll(); foreach (var node in this._tree.Nodes) { if (node.Text.Equals(this._searchTextbox.Text, StringComparison.OrdinalIgnoreCase)) { this._tree.ActiveNode = node; node.Selected = true; break; } }
The control's HideSelection property defaults to true; assuming you executed this code at a point when the control does not have focus, selection would not be visually depicted. Try setting HideSelection to false.
EDIT: wrong post