Hi, Haneef,
Thank you for the prompt response. your code snipet is helpful, but what I am trying to get at is a bit different.
If I want to create a customised control based on syncfusion grid Can I
A) Create an Inherited Custom control(in VS2005)
B) Use Inheritance
From you response It seems that you have taken the inheritance approach, is approach # 1 possible ?
Thanks,
Jogesh
>Hi Jogesh,
You would have to derive the GridControl and set ContextMenu property to display the standard menu in a grid when you right clicked on the cell. Here is a code snippet to show this.
public class MyGridControl : GridControl
{
public delegate void objContextMenuClick(object sender ,EventArgs e);
public event objContextMenuClick ContextMenuClick;
public MyGridControl()
{
ContextMenu menu = new ContextMenu();
menu.MenuItems.Add("Copy");
menu.MenuItems.Add("Paste");
menu.MenuItems.Add("Edit");
for(int i = 0;i< menu.MenuItems.Count;i++)
menu.MenuItems[i].Click += new EventHandler(OnContextMenuClick);
this.ContextMenu = menu;
}
void OnContextMenuClick(object sender, EventArgs e)
{
if (ContextMenuClick != null)
{
ContextMenuClick(sender, e);
}
}
}
Please refer to the attached sample for implementation and let me know if this helps.
InheritedGridControl.zipBest regards,
Haneef