Brian Ng
Brian Ng

Reputation: 35

Right click menu customise on gridControl / gridView1 (C# / DevExpress) Programatically

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

Upvotes: 1

Views: 960

Answers (2)

Brendon
Brendon

Reputation: 1259

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

Upvotes: 1

Bucketcode
Bucketcode

Reputation: 481

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

Upvotes: 1

Related Questions