I have a TreeView populated with nodes, with an associated ContextMenu (at the TreeView level – not set on individual nodes). This works fine.
Now, I want to refresh the tree view with a new set of nodes.
m_treeView.Nodes.Clear();
// Add new nodes…
What I see is that the new nodes now appear on the tree view visual (in the browser), but the old nodes that I Cleared() are also still visible (and active!).
If I change to
m_treeView.Nodes.Clear(true);
Now the old nodes go away as expected, but the ContextMenu is wiped out (all items removed – by the call to TreeViewNodeCollection.Clear(true)). If I rebuild the ContextMenu and re-attach it to the TreeView, I’ll see the correct visuals, but the context menu no longer works – no menu appears on right-click. Even if I set the ContextMenu on each node, no menu appears.
What the heck is going on here? This is in code originally written for WinForms, then ported to VWG, then ported to WiseJ. Never had a problem with it until now.
Hi Carl,
Are you perhaps using a version older than 3.1.9?
This issue was fixed in that version (3.1.9), and I have also tried to reproduce using the latest 3.2.2 version and I couldn’t reproduce it!
HTH,
Alaa
Upgrade to 3.2.2 fixed it.
Please login first to submit.