Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Setting active UltraTree node in code does NOT highlight it
posted

I have tried every solution mentioned on these forums, with multiple variations, and the active node is still not highlighted (with background color) when the tree is loaded.

I set the tree data source to a dataset and expanded everything, this all works great.

I then tried several variations of the below, but the node is never highlighted.

var node = ultraTree1.GetNodeByKey("5");
ultraTree1.SelectedNodes.Clear();
node.BringIntoView();
ultraTree1.ActiveNode = node;
ultraTree1.HideSelection = false;
node.Selected = true;

The active node is correct and loads my list view with the related data.  Even trying to override the back color didn't work.  When I manually select the node, it highlights properly.

Parents
  • 34810
    Offline posted

    Hello Sam,

    With the default implementation of the UltraTree, the tree needs to be the focused control to be able to see the active / selected node. You can override this by setting the following though:

    this.ultraTree1.Override.ActiveNodeAppearance.BackColor = SystemColors.Highlight;
    this.ultraTree1.Override.ActiveNodeAppearance.ForeColor = Color.White;

    Please let me know if you have any other questions or concerns on this matter.

Reply Children