Hi Shri,
Yes, it is possible to display a custom context-menu depending on which node the context-menu was invoked.
Please handle the TreeViewAdv''s MouseDown event as shown below for this purpose :
private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
// Get the node on which the context-menu was invoked
Point p = this.treeViewAdv1.PointToClient(Control.MousePosition);
TreeNodeAdv node = this.treeViewAdv1.PointToNode(p);
// Set custom BarItems for each node
BarItem bitem = new BarItem();
bitem.Text = "This is " + node.Text;
// Clear the previous node''s BarItems
this.parentBarItem1.Items.Clear();
// Add new node''s BarItems
this.parentBarItem1.Items.Add(bitem);
}
}
The
complete sample illustrating this is attached here. Please refer to it and let me know if this meets your requirements. Thanks for choosing Syncfusion products.
Regards,
Guru Patwal
Syncfusion, Inc.