TreeView.Nodes.ClearAll() - Problem version 1.5.4.0

0
0

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,

 

 

 

  • You must to post comments
1
0

Hi Marcelo,

the problem is fixed in the latest Wisej development build (1.5.6).

Best regards
Frank

  • You must to post comments
0
0

Hi Luca,

Yes, using

treeView.Nodes.Clear();

treeView.ExpandAll();

before load nodes works as intended.

Is it will be corrected in nest release ?

Regards.

  • Luca (ITG)
    Will be fixed in the next dev build or release, whichever comes out sooner. The extra call to ExpandAll() is harmless anyway, it simply resets the flag.
  • You must to post comments
0
0

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.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.