1

how to customize the right click menu on gridcontrol? I try tp put the export option on the menu. I try to search inside the Grid Design still unable to find it. Try to google this for weeks. Need guidance from the master. TQ

enter image description here

Brian Ng
  • 35
  • 3
  • 12

2 Answers2

1

There is a single control name contextmenu you can add it from code or designer then add some events. you can google it youself or Adding a right click menu to an item

Community
  • 1
  • 1
Bucketcode
  • 461
  • 2
  • 13
  • I know is something to do with DataGridView header menu, i google many samples, still unable to understand, as i try search for the example code (in programmatically way) for guidance. I know need manually code in the option into the existing gridview right click menu. But i still miss out some important key step to do so. I try to add the menu option into the existing one. – Brian Ng Oct 09 '16 at 13:47
  • Hi CodeFarmer, I solved my case, due to i manage found our code of DLL. Anyway your guidance still very useful for my next full complete front end system development. Thank you. – Brian Ng Oct 09 '16 at 15:10
1

You can handle the GridView's PopupMenuShowing event and customize the built-in Grid menu(s):

private void gridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
{
    if (e.MenuType != DevExpress.XtraGrid.Views.Grid.GridMenuType.Column)
        return;

    DXMenuItem restoreItem = new DXMenuItem() { Caption = "Restore Layout" };
    restoreItem.Click += restoreItem_Click;

    e.Menu.Items.Add(restoreItem);
}

private void restoreItem_Click(object sender, EventArgs e)
{
    MessageBox.Show("Restoring layout...");
}

See also: How to: Implement Custom Menu in XtraGrid Control

Brendon
  • 1,238
  • 1
  • 7
  • 8