Any way to get all TreeNodes in a TreeView have the '+' symbol?
-
I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff
-
I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff
-
I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff
Easy. Give every node a "dummy" child. When a node is expanded, you check the children of the node for the "dummy" child node. If it's there, remove it and populate the children as you see fit.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Easy. Give every node a "dummy" child. When a node is expanded, you check the children of the node for the "dummy" child node. If it's there, remove it and populate the children as you see fit.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Thanks Dave, I was hoping there was a bit easier way, but this sounds reasonable. Thanks, Jeff
jeffb42 wrote:
I was hoping there was a bit easier way, but this sounds reasonable.
Not that I've found. That's about as easy as it gets.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007