Hi.
Before version 1.5.4.0 I didn´t had a problem load treeView.
I first clear all nodes them load then.
Now, after update to version 1.5.4.0, , if I clear the previous nodes I need to Expand all after load it, or I see nothing in TV.
Is it a bug ?
Previous – works fine:
tvSectors.Nodes.Clear();
boSectors s = new boSectors();
boSubsectors ss = new boSubsectors();
s.GetSectors();
foreach (boSectors b in s.GetEnumerable())
{
TreeNode n = new TreeNode();
n.Text = b.SectorShort;
n.Tag = “ST” + b.SectorId;
}
tvSectors.Nodes.Add(n);
Version 1.5.4.0 – not working previous code
tvSectors.Nodes.Clear();
boSectors s = new boSectors();
boSubsectors ss = new boSubsectors();
s.GetSectors();
foreach (boSectors b in s.GetEnumerable())
{
TreeNode n = new TreeNode();
n.Text = b.SectorShort;
n.Tag = “ST” + b.SectorId;
}
tvSectors.Nodes.Add(n);
tvSectors.ExpandAll() <<<—- have to put this code to works
Regards,
Hi Marcelo,
the problem is fixed in the latest Wisej development build (1.5.6).
Best regards
Frank
Hi Luca,
Yes, using
treeView.Nodes.Clear();
treeView.ExpandAll();
before load nodes works as intended.
Is it will be corrected in nest release ?
Regards.
Unfortunately yes, it’s a regression in Nodes.Clear() it makes the parent node’s property IsExpanded false, which is correct. Before calling Nodes.Clear() on an expanded node it left the property IsExpanded true. But… it also collapses the root node, the bug. You can simply do this as a workaround (as you have found out):
treeView.Nodes.Clear();
treeView.ExpandAll(); // doesn’t have to be after adding nodes.
Please login first to submit.