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. Image for the cookie policy date
close icon

How To Supress ContextMenu On Certain Nodes

Below is a snippet of code from a popup menu on a syncfusion treeview. The problem is that I cannot consistently prevent the menu from coming up. If I go the node where I AM allowing the popup to come up and right click on it, then the menu comes up as you would expect. The problem is that when I the point to another node and quickly right click on it and do not expect the menu to come up, then it still continues to come up. The problem is that the treeview does not have the correct value as its SelectedNode (it continues to hold the value from the original node). Im filtering by the tag on the node and this should work with no problems, but there seems to be a bug with the selectednode value when consistently right clicking on the mouse and pointing to different nodes. Does anyone have a better idea on how to supress the menu for certain nodes? private void contextMenu2_Popup(object sender, System.EventArgs e) { this.rightMouseDownNodeCached = this.tvLeads.RMouseDownNode; // This will be null if the user clicked in the empty portion of the tree. if(this.tvLeads.RMouseDownNode == null) { this.editItem2.Visible = false; this.pasteItem2.Visible = false; this.deleteItem2.Visible = false; } else { if(tvLeads.SelectedNode.Tag == "somevalue") { this.editItem2.Visible = true; this.pasteItem2.Visible = true; this.deleteItem2.Visible = true; } else { this.editItem2.Visible = false; this.pasteItem2.Visible = false; this.deleteItem2.Visible = false; } } }

1 Reply

DT Deepa TS Syncfusion Team October 18, 2005 12:51 PM UTC

Hi timjax, With the help of the RMouseDownNode property itself ,we can find the node which is been right clicked. Please take a look at this sample, contextmenu.zip which reproduces your problem. Here the above sample shows that,the selected node is not same as the node which is been right clicked. Please let me know if you have any questions.Thanks for your interest in Syncfusion products. Regards, Deepa.T.S

Loader.
Live Chat Icon For mobile
Up arrow icon