I am having trouble figuring out what the problem is. I googled around and did not find many solutions to this problem. The only βsolutionβ I found was a hack to expand and then collapse the last node.
this.Nodes[this.Nodes.Count - 1].Expand(); this.Nodes[this.Nodes.Count - 1].Collapse();
As you can see in this screenshot, the last node is partially disabled, and the only way to expose it is to expand the node, which will make the TreeView correctly display it.

I pragmatically add nodes to the TreeView. I donβt know if this affects the result, but I expanded TreeView to my own class, so I can add several properties and methods to it.
public class MyTreeView : TreeView { public void BuildTree() { this.Nodes.Clear(); foreach (TestSetFolder folder in Folders) { MyTreeNode node = new MyTreeNode(); node.Name = folder.Name; node.Text = folder.Name; node.Tag = folder; node.FolderID = folder.NodeID; node.IsPopulated = false; this.Nodes.Add(node); } } }
This is how I add nodes to the list. Does anyone have a clean solution to this problem?
source share