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

TreeView and popup menu

If I have a popup menu associated with multiple treeview controls, how do I determine which control was the one that the menu selection occurred on. And is it also possible to determine the actual node, or do I need to select the node first and just use the selectednode property?

1 Reply

AD Administrator Syncfusion Team November 27, 2002 05:13 PM UTC

Chuck, You ca use the PopupMenu.SourceControl to determine on which TreeView the context menu was shown. And yes, please select the node on mouse down, as follows: private void treeView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if(e.Button == MouseButtons.Right) { treeView1.SelectedNode = treeView1.GetNodeAt (e.X ,e.Y ); } } and then use the SelectedNode property. Regards, Praveen Ramesh

Live Chat Icon For mobile
Up arrow icon