I am using a Windows Forms TreeView
control in my program. I would like to allow the user to select multiple nodes at the same level by dragging their mouse pointer around (also called a "lasso" selection). I don't think a standard TreeView
allows that.
My question is what would be the best way to achieve this? Do I have to write custom selection behaviour of my own in perhaps a custom or derived control? Where do I start?
I don't need a detailed explanation. Just a small nudge in the right direction.
A tree-view control is a window that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the files and directories on a disk. Each item consists of a label and an optional bitmapped image, and each item can have a list of subitems associated with it.
TreeView enables you to edit nodes in applications, you need to set the AllowEditing property of the C1TreeView class to true. The default value of the property is false. You can start editing a node by selecting a node and pressing the Enter or F2 key, or simply double-clicking the node itself.
The TreeNode class represents a node of a TreeView.
This is not going to be easy to do with a standard WinForms TreeView
control. The TreeView
control only supports single selection per tree. It is not possible to simultaneously select multiple nodes in the tree.
In order to get this behavior you would likely end up needing to create a very similar class to TreeView
which allowed for multiple selection. Another option is to derive from TreeView
and enable multiple selection by overriding specific behaviors. Here is an article on how to do the latter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With