Hi Nik,
You could customize the context menu to display the name of the selected node when right clicked on it by handling the MouseDown Event handler.
Code:
private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button==MouseButtons.Right)
{
//Clear the contextMenu Menuitems ,so that only the SelectedNode text get displayed
this.contextMenu1.MenuItems.Clear();
this.treeViewAdv1.SelectedNode=this.treeViewAdv1.GetNodeAtPoint(new Point(e.X,e.Y));
//If the selected node is not equal to null, create MenuItem
if(this.treeViewAdv1.SelectedNode!=null)
{
//Create MenuItem for the SelectedNode
MenuItem menuitem=new MenuItem(this.treeViewAdv1.SelectedNode.Text);
this.contextMenu1.MenuItems.Add(menuitem);
}
}
}
Please take a look at the attached sample which illustrates this above functinality. Let me know if this helps you.
Thanks for your interest in Syncfusion products.
Kind Regards,
Deepa.
CustomizeContextMenu.zip