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.
Unfortunately, activation email could not send to your email. Please try again.

SetXPContextMenu on TreeViewAdv, how to get the Node

Thread ID:

Created:

Updated:

Platform:

Replies:

68193 Sep 11,2007 02:17 PM Sep 12,2007 10:17 PM Windows Forms 1
loading
Tags: Tools
Oleg Ogurok
Asked On September 11, 2007 02:17 PM

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.

Rajagopal [Syncfusion]
Replied On September 12, 2007 10:17 PM

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

CONFIRMATION

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.

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.

;