Completed
Last Updated: 28 Oct 2013 16:09 by Jesse Dyck
ADMIN
Georgi I. Georgiev
Created on: 03 Jul 2013 07:36
Category: TreeView
Type: Bug Report
3
FIX. RadTreeView - exception when clearing child nodes
To reproduce: private void btnFill_Click(object sender, EventArgs e) { radTreeView.BeginUpdate(); radTreeView.Nodes.Add(new RadTreeNode("root 1")); radTreeView.Nodes.Add(new RadTreeNode("root 2")); radTreeView.Nodes.Add(new RadTreeNode("root 3")); radTreeView.Nodes.Add(new RadTreeNode("root 4")); radTreeView.Nodes[radTreeView.Nodes.Count - 1].Expand(); for (int i = 0; i < 30; i++) { radTreeView.Nodes[radTreeView.Nodes.Count - 1].Nodes.Add(new RadTreeNode("text" +i)); } radTreeView.EndUpdate(); } private void radButton1_Click(object sender, EventArgs e) { radTreeView.BeginUpdate(); foreach (var node in radTreeView.Nodes[radTreeView.Nodes.Count - 1].Nodes.ToArray()) { node.Remove(); } for (int i = 0; i < 99; i++) { radTreeView.Nodes[radTreeView.Nodes.Count - 1].Nodes.Add(new RadTreeNode("aasdasd")); } radTreeView.EndUpdate(); } Workaround - reset the traverser and update the scroll value prior removing the nodes radTreeView.TreeViewElement.Scroller.Traverser.Reset(); 

this.treeView.TreeViewElement.Scroller.UpdateScrollValue();
1 comment
Jesse Dyck
Posted on: 28 Oct 2013 16:09
The workaround avoids the NullReferenceException but exposes a subsequent problem with the traverser:

http://www.telerik.com/community/forums/winforms/treeview/radtreeview-scrollbar-fall-with-nullreferenceexceprion.aspx#2846872

Thank you