4
votes

I have a GridControl with some rows on my DevExpress interface. When I right-click on some row of the grid I want to pop-up the same kind of menu like when i right-click on my desktop(win 7), but only with 3 options - Cut, Paste and Copy.

How to make this? Is there a way to say in the property editor of the GridControl "for every row if right-click then popup a Menu". If so, is this menu stored in a repository and what type is this menu?

2

2 Answers

1
votes

Handle the GridView's ShowGridMenu event to show the context menu when a gridRow is clicked. We have also published an example showing how this event can be used:

How to show a context menu for grid rows

3
votes
  1. Add a DevXpress.ExtraBars.BarManager Control.
  2. Add a DevXpress.ExtraBars.PopupMenu Control.
  3. Create your menu structure inside the PopupMenu control.
  4. Add this code into the 'PopupMenuShowing' event of your GridView:

    private void gridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) 
    {
        if (e.HitInfo.InRow) 
        {
            System.Drawing.Point p2 = Control.MousePosition;
            this.popupMenu1.ShowPopup(p2);
        }
    }
    

That's It!