Expanding a TreeNode without selecting the Node in a Treeview
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
If e.Node.IsSelected Then
'...
End If
End Sub
Issues
Current issues with NodeMouseClick:
- NodeMouseClick event does not fire
- Moving with your keyboard selecting an event does not fire NodeMouseClick
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=237301
In this case you better use the AfterSelect event:
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
If e.Node.IsSelected Then
'...
End If
End Sub