C# 如何:突出显示 UltraTree 中的选定节点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/863580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:42:02  来源:igfitidea点击:

HowTo: Highlight the selected node in a UltraTree

c#infragisticsultratree

提问by lostiniceland

I have a UltraTree control 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 UltraTree?

我有一个 UltraTree 控件,它选择要在 UltraTabControl 中显示的页面。我正在捕捉一个事件并找出我想要选择树中的哪个节点。这一切正常,只有一件事(视觉)不会:激活的节点没有在 UltraTree 中突出显示?

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).

实际上我假设,当我调用 select() 时,我的节点也会被突出显示(我的意思是它周围的蓝色选择框)。

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

这可能是一个非常简单的问题,但我现在尝试了很多属性和方法,但仍然没有成功。

Thanks

谢谢

采纳答案by JP Alioto

This should work for you (set before you set Selected)...

这应该对您有用(在设置 Selected 之前设置)...

pageTree.HideSelection = false;

回答by Brett Veenstra

Try looking here:

试试看这里:

       Infragistics.Win.UltraWinTree.Override ovr;

       // Get the tree's Override property so we can
       // set the default for all nodes.
       ovr = this.ultraTree1.Override;

       // Turn hot tracking on
       ovr.HotTracking = DefaultableBoolean.True;

       // Set the borderstyle to solid but the border color
       // to trasnparent so the borders don't show by default.
       ovr.BorderStyleNode = UIElementBorderStyle.Solid;
       ovr.NodeAppearance.BorderColor = Color.Transparent;

       // Set default border colors for active, expanded,
       // hot tracked and selected nodes.
       ovr.ActiveNodeAppearance.BorderColor = Color.Red;
       ovr.ExpandedNodeAppearance.BorderColor = Color.Magenta;
       ovr.HotTrackingNodeAppearance.BorderColor = Color.Blue;
       ovr.SelectedNodeAppearance.BorderColor = Color.Black;

The other issue you might have is that the UltraTreecontrol is not Enabled.

您可能遇到的另一个问题是UltraTree控件未启用。