I've got this scenario:
Tree.SelectedNodes contains aTreeNode.
var
parentNodesCollection = aTreeNode.ParentNodesCollection;
parentNodesCollection.Remove(aTreeNode);
Tree.SelectedNodes *still* contains aTreeNode after the remove.
I've tried:
Tree.SelectedNodes.Clear();
Tree.ActiveNode.Selected = true
and neither have worked. The tree shows the next node corrected selected and active, but Tree.SelectedNodes still contains the old value(s) until I click on another node. Is this a bug or am I doing something wrong? Thanks.
What version of the controls are you using?
This sounds like a bug that was fixed years ago.
Hi Mike,
It's UltraWinTree v10.2.20102.2026.
Hm, I guess not, then. Can you post a small sample project demonstrating this?
If you are removing a node from the tree and that node is still in the SelectedNodes collection, then that is clearly a bug that needs to be addressed.
I created small application and was unable to reproduce the issue, so it tells me it's because I'm doing something wrong/different in my code. I tried a simple:
Tree.SelectedNodes.Clear()
and it's not clearing it. Are there any properties of the tree that can be set to cause this condition? Thanks.
I just noticed that Tree.SelectedNodes.IsReadOnly = true. Is this what the problem could be?
I figured out what was causing the problem. I was cancelling the selection in the BeforeSelect event handler because a particular condition wasn't met. Everything works fine now. Thanks for your help.