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
190
Highlight the selected node in a TreeView
posted

Hello Everyone

I have a UltraTreeView which selects a page to display in a UltraTabControl. I am catching an event and figure out which node in the tree I want to select. This works all fine, just one (visual) thing wont: the activated node is not highlighted in the treeview?

This is what I am doing

pageTree.ActiveNode = pageTree.Nodes[tab.Key];
pageTree
.ActiveNode.Selected = true;
// raise an selection-event, so the right tab gets displayed
pageTree
.Select();

Actually I assumed, that when I call select() that my node will be highlighted as well (I mean the blue selectionbox around it).

Its probably a very simple issue but I tried quite some properties and methods now, but still no success.

Thanks

  • 69832
    Suggested Answer
    Offline posted

    The Select() method is inherited from the base Control class and actually has no bearing on node selection. Having said that, it is relevant to note that the control's HideSelection property (which determines whether the control depicts node selection when not focused) defaults to true, which means that by default the control does not depict node selection when not focused.

    Since you are calling the Select method, the control should get focused and thus should depict node selection, so I'm afraid I don't have an explanation for why the node doesn;t look selected. I also verified that this functions as as expected when parented to an UltraTabControl. If possible post a short sample that demonstrates the problem and we can take a look.