0
votes

There are a ContextMenuStrıp and Devexpress GridControl. When I right mouse click on the grid header, they appear context menu strip and Devexpress menu.

Only I want to only appear Devexpress menu (not contextmenu) , when I right click on grid header.

2

2 Answers

0
votes

When you handle the mouse up event, you need to verify if the click was in a row or a cell, like so :

GridHitInfo hitInfo = view.CalcHitInfo(e.Location);

// Verify that the click was in a cell of a row, if not, don't do anything
if (!hitInfo.InRowCell)
    return;
0
votes

First, I want to say thank you. I solved my problem with codes which is below.

private void gridView1_MouseUp(object sender, MouseEventArgs e)
    {
        GridView view = (GridView)sender;
        GridHitInfo hitInfo = view.CalcHitInfo(e.Location);

        if (!hitInfo.InRowCell)
            contextMenuStrip1.Visible = false;
        else
            contextMenuStrip1.Visible = true;
    }