Logged In: NO

I figured out what the problem was:
I had to clear the control at each refresh of the tree, because they weren't getting cleared properly. So initially I used the Controls.Clear() method on the listview control, but that removed all controls including the scrollbars.

To avoid this problem, I changed the code to clear the controls properly as follow:

public void Clear()
{
// _listView.BeginUpdate(); // we don't want this at each loop, so I put it outside the Clear call.

//avoid firing one SelectedItemsChanged event for every selected item
if (_listView.SelectedItems.Count > 0)
_listView.SelectedItems.Clear();

for(int index = 0; index < _data.Count; ++index)
{
ContainerListViewItem item = this[index];

item.Selected = false;
item.Focused = false;
//item.OwnerListView = null; //this is causing the control to be null, and cause trouble at the next call. I am not even sure what what th use here in the first place.

//added
//Looping through all the items of the tree, which wasn't done: only 1st level of the tree was cleared, leaving control in subtree items in place.
if (item.Items.Count > 0)
{
item.Items.Clear();
}
//end added

for(int subIndex = 0; subIndex < item.SubItems.Count; ++subIndex)
{
if (item.SubItems[subIndex].ItemControl != null)
{
//item.SubItems[subIndex].ItemControl.Parent = null;
//item.SubItems[subIndex].ItemControl.Visible = false;
//added
item.SubItems[subIndex].ItemControl.Dispose();
//Dispose of the control instead of making the control link null: that actually clears the control, not just hide it.
//end added
}
}
}
_data.Clear();

// _listView.EndUpdate();
}