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

SetXPContextMenu on TreeViewAdv, how to get the Node

Hi there,

I have a TreeViewAdv and a context menu, which shows when I right-click a node on the tree.
this.popupMenusManager1.SetXPContextMenu(this.myTreeView, this.popupMenu1);

Then I subscribe to the click event of the BarItem that was left-clicked. In the event handler, how do I find the node in the tree that was Right-Clicked?

Thanks,
-Oleg.

1 Reply

RA Rajagopal Syncfusion Team September 13, 2007 02:17 AM UTC

Hi Oleg,

Thanks for your interest in Syncfusion Products.

Please try the code below in the MouseDown event of the TreeViewAdv to determine the node that was right clicked.

void treeViewAdv1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
Point p = this.treeViewAdv1.PointToClient(Control.MousePosition);
TreeNodeAdv node = this.treeViewAdv1.GetNodeAtPoint(p);
Console.WriteLine(node.Text);
}
}


Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon