How? - Single Left Mouse Click on Node Text to Expand/Collapse Node

VB WinForms TreeViewAdv.

To expand/collapse nodes, a double left mouse click is needed on the node text.  How can I change that to a single left mouse click?

I don't know if it is called "Node Name" or "Node Text" but it is the text you view when looking at the node, to the right of the plus/minus.

Thank you for your help in this matter.


3 Replies 1 reply marked as answer

SB Sweatha Bharathi Syncfusion Team June 29, 2023 11:55 AM UTC





Bruce Halpern ,


Your requirement, "Single Left Mouse Click on Node Text to Expand/Collapse Node," can be achieved by using the mouseclick event. We have provided a sample based on your requirement. Please review the sample and let us know if you have any further concerns. See the code snippet below:



              Private Sub TreeViewAdv1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)

                                           If e.Button = MouseButtons.Left Then

                                                          Dim clickedNode = treeViewAdv1.GetNodeAtPoint(e.Location)

                                                          clickedNode.Expanded = Not clickedNode.Expanded

                                           End If

                             End Sub

             












Attachment: Vb_Sample_bcf81d1.zip

Marked as answer

BH Bruce Halpern June 29, 2023 01:16 PM UTC

Sweatha Bharathi,

Thank you very much for your reply.

It worked, although I had to change the first line to:

Private Sub TreeViewAdv1_MouseClick(sender As Object, e As MouseEventArgs) Handles TreeViewAdv1.MouseClick


Thank you.



SB Sweatha Bharathi Syncfusion Team June 30, 2023 12:05 PM UTC

Bruce Halpern ,


If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you😊.


Loader.
Up arrow icon