I have a Winform application where I am using TreeView. Some users of this application have a problem that they must double click on a node to expand it. So I added this code to use single click to expand nodes:
Private Sub MyTreeView_NodeMouseClick(sender As System.Object,
e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles MyTreeView.NodeMouseClick
If e.Node.IsExpanded Then
e.Node.Collapse()
Else
e.Node.Expand()
End If
End Sub
This works but I noticed strange behavior regarding clicking on a nodes. I noticed that there are 2 places with different behavior. First place is with +/- symbol and dots next to it (first circle in the picture), second place is a text of the node (second circle):
Normally single click on the first place is enough to expand node and double click must be done on the second place to expand node. Then when I use my code, single click on the second place is enough to expand the node but when I do single click on the first place, the node is expanded and collapsed.
Why the user must do twice more clicks on the second place to expand node? What can I do to expand nodes with single click on both places? Thank you guys!