I am using RadControls for WinForms Q1 2011
and Visual Studio 2012, Ultimate Edition
to develop a .NET4.0 app.
The app uses RadTreeView
for showing a very simple file system explorer and removes nodes in two cases:
1. On NodeExpandedChanged
the event handler removes a dummy node representing a collapsed directory with a new node.
sender, RadTreeViewEventArgs e)
RadTreeNode l_parent = e.Node.Parent;
l_nIx = e.Node.Index;
RadTreeNode l_new = CreateDirNode(
This code works just fine.
2. On EventArrived
fired by System.Management.ManagementEventWatcher
upon CD insertion/ejection the event handler removes either a node representing the empty drive or a node representing the CD file system.
Currently I narrowed the code just to the attempt to remove a CD node
sender, EventArrivedEventArgs e)
ManagementBaseObject l_wmiDevice = (ManagementBaseObject) e.NewEvent[
l_sDriveRootDir = l_wmiDevice[
].ToString() + Path.DirectorySeparatorChar;
l_nIx = m_fileExplorer.Nodes.Nodes.IndexOf(l_sDriveRootDir);
I tried different ways of removing the node, I tried wrapping the code with BeginUpdate()
, I tried calling Invalidate()
- the result is always the same
a) The node itself is still shown, although the debugger shows that the nodes count has decreased;
b) Expanding other nodes, e.g. a node representing C:\
, does not work any more, i.e. the event is fired, but view remains unchanged.
: The only difference between the nodes removed in the cases #1 and #2 is that OnDirExpanded()
removes only grandchildren or farther of the root node, while OnCdInsert()
removes a child of the root node.
I am really lost and your help is my only hope now.
I am looking forward to your assistance and thank you in advance for it.