We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Context menu of a tree node

Thread ID:





17735 Aug 15,2004 05:01 PM UTC Aug 15,2004 09:33 PM UTC WinForms 1
Tags: Tools
Asked On August 15, 2004 05:01 PM UTC

Hi, How can i add context menu to a tree node Syncfusion tree has a context menu property for the whole tree component what if i need only for a particular node Shri

Administrator [Syncfusion]
Replied On August 15, 2004 09:33 PM UTC

Hi Shri, Yes, it is possible to display a custom context-menu depending on which node the context-menu was invoked. Please handle the TreeViewAdv''s MouseDown event as shown below for this purpose : private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) { // Get the node on which the context-menu was invoked Point p = this.treeViewAdv1.PointToClient(Control.MousePosition); TreeNodeAdv node = this.treeViewAdv1.PointToNode(p); // Set custom BarItems for each node BarItem bitem = new BarItem(); bitem.Text = "This is " + node.Text; // Clear the previous node''s BarItems this.parentBarItem1.Items.Clear(); // Add new node''s BarItems this.parentBarItem1.Items.Add(bitem); } } The complete sample illustrating this is attached here. Please refer to it and let me know if this meets your requirements. Thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon