context menu activation

Having a problem getting the context menu to activate on a treenavigator control. I can't find any resource on it. Please help.



6 Replies 1 reply marked as answer

RR Richard Rooks March 12, 2021 03:20 PM UTC

Also, this is for winforms app.


RR Richard Rooks March 12, 2021 05:08 PM UTC

I figured it out. But I do have a question, how do I know the node that was right clicked?

Richard


EM Elakkiya Muthukumarasamy Syncfusion Team March 15, 2021 02:00 PM UTC

Hi Richard, 

Greetings from Syncfusion. 

We are working on this reported query “how do I know the node that was right clicked” and we will update you the further details on 17th March 2021.We appreciate your patience until then. 

Regards, 
Elakkiya 



VR Vijayalakshmi Roopkumar Syncfusion Team March 17, 2021 09:49 AM UTC

Hi Richard,  
 
Thank you for your patience. 
 
From your update, we could understood that you want to detect when the TreeMenuItem get right clicked and active context menu. For this requirement, you can use MouseClick event of particular TreeMenuItem and check for right button, it will detect that particual item has been right clicked or not. Similary, you can activate the Contextmenu for that particular menuitem using the following code: 
 
Code:[C#] 
 
 
private void TreeMenuItem1_MouseClick(object sender, MouseEventArgs e) 
        { 
            //detect whether the menuitem has been right clicked 
            if (e.Button == MouseButtons.Right) 
            { 
              // Activate the contextmenu strip 
                contextMenuStrip.Show(Cursor.Position); 
            } 
        } 
 
 
 
 
 
 
 
Please try this suggestion and let us know if it is helpful. 
 
Regards, 
Vijayalakshmi VR 


Marked as answer

RR Richard Rooks March 17, 2021 02:46 PM UTC

Thanks, I will try it.


VR Vijayalakshmi Roopkumar Syncfusion Team March 18, 2021 05:05 AM UTC

Hi Richard 
 
Thank you for your update. 
 
Please let us know if you need any other assistance on this. 
 
Regards, 
Vijayalakshmi VR 


Loader.
Up arrow icon