Hi,
I have a requirement in which I need to enable user to select multiple nodes using ctrl key on the tree based on a criteria (node type). Overriding the SelectionType = Extended and SelectionBeavior = ExtendedAcrossCollections would enable me to select nodes of any type.
If my tree is modelled like below, I want to enable Ctrl+Selection only on nodes B1, B2, B3 and D1, D2, D3. Anywhere else the Ctrl+selection should function as select single node. Let me know if this behavior can be achieved?
A (root)
B(child)
B1, B2, B3 (children of B)
C (Child)
C1, C2, C3
D (Child)
D1, D2, D3
Hello ,
Nodes collection of Node object has Override property, which you could adjust in order to manage selection type of this collection. For example you could set
ultraTree1.GetNodeByKey("B").Nodes.Override.SelectionType = Infragistics.Win.UltraWinTree.SelectType.Extended;
And then child nodes of B node will be multiselected. Please see attached sample.
Please let me know if you have any further questions.
This is perfect sample doing half of my requirement. Can you please let me know if I can select nodes across collections? I want to have multi-select across B & D too, i.e B1 and D1 to be selected.
I tried UltraTree.SelectionBehavior to be extended across collection, but that seems to select multiple nodes of "C". Let me know if I can try anything else?
Thanks,
Chandrakant.
You may not have noticed it, but Hristo attached a sample project to his post which does exactly what you asked for. Did you try the sample?
Basically, you can control the selection at any level of the tree - anywhere there is an Override. So in the sample, the tree is single-select, but Nodes "B" and "D" are set to allow multi-select.
Mike,
I did try the sample attached by Hristo with my 10.3 version of infragistics, the sample doesn't allow me to select one node of B (say B1) and another node of D (D3). Can we allow cross node multi selection (between B1 + D3) by overriding at node levels?
Let me know if this is supported or any work around for the same. Am using 10.3 version of Infragistics, Let me know if I need to upgrade to v12 to support this.
Oh, sorry. It wasn't clear to me that that wasn't working.
There's no way to do that with just properties settings. Once you turn on SelectionBehavior.ExtendedAcrossCollections, it's going to ignore the setting on the Override.
For more complex selection validation like you want, you will have to write code. What you can do is handle the BeforeSelect event, examine the NewSelections, and if it violates what you want to allow, you just set e.Cancel to true.
Do you mean to enable SelectionType = Extended on the whole tree and then in the BeforeSelect event of the node I check my condition and cancel if it is not the node of my preference.
It sounds good. Will give a try tomorrow A.M and let you know.
Thanks for your quick response.
Hello,
If you want to have cross node selection, then you should set SelectionBehavior property of UltraTree to ExtendAcrossCollection. The you could handle BeforeSelect Event of UltraTree, in order to disallow multi- selection of the specific nodes. I have modify my sample in order to demonstrate you this approach. Please feel free to modify my sample based on your needs.
I hope that this will helps you.
You could manage the appearance of particular node trough NodeAppearance object. You could use code like:
UltraTreeNode node = ultraTree1.GetNodeByKey("Your Node key");
node.Override.NodeAppearance.BackColor = Color.Red;
On the following link you will find more information about NodeAppearance and sample tutorial how to do this.
http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.2/CLR4.0/html/Infragistics4.Win.UltraWinTree.v12.2~Infragistics.Win.UltraWinTree.Override~NodeAppearance.html
In ultrawintree how can we highlight and node with some color programmatically.
Hristo,
Awesome, am looking for this functionality. Thanks for quick resposne.