Take the 2-minute tour ×

I have a .Net desktop application with a TreeView as one of the UI elements.

I want to be able to multi-select that TreeView, only that isn't supported at all.

So I'm adding check-boxes to the tree, My problem is that only some items are selectable, and those that aren't can't consistently cascade selections.

Is there any way to disable or hide some check-boxes while displaying others?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

The default behavior of TreeView is that when the Checkboxes property is set to true, that checkboxes will be shown for all TreeNodes.

The behavior that you are looking for - to disable or hide some checkboxes - is a custom modification of the normal behavior. You can create a custom implementation of TreeView or TreeNode that overrides the default behavior. One other thing to try would be to use the TreeView.StateImageList property. Some sites to check out for more info:

share|improve this answer

I had a very similar problem in an editor I wrote recently. In the end, I used the TreeNode's BackColor property to determine the selection state of the node. I then wrote a handler for the SelectionChanged event that checked the state of the Shift/Control keys to determine if the selected node was being added to/removed from the selection or creating a new selection. There was also a Generic::List<> of the nodes that were currently selected to eliminate any tree searches.

share|improve this answer


Why doesn't .NET have a multiselect treeview? There are so many uses for one and turning on checkboxes in the treeview is a pretty lousy alternative.

share|improve this answer

Your Answer


