This is a migrated thread and some comments may be shown as answers.

context menu keeps focus?

1 Answer 212 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 13 Jan 2012, 05:44 PM
I added a context menu to a RadGridView and when I handle the Click I show a dialog.  The dialog pops up but somehow it does not have focus...even though I called ShowDialog.  I actually have to click on the dialog for it to have focus.  Also, the menu stays visible and it has focus.  If I hit the ESC key the context menu goes away and then the dialog gains focus.

1) how should I be handling the menu item being selected so that this won't happen?
2) where is there real documentation on context menus?

1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 17 Jan 2012, 11:54 AM
Hello Ken,

This may happen when using both RadGridView built-in context menu and the standard Microsoft context menu. You can either disable the integrated context menu, or customize it:
void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    // disable the integrated context menu
    e.Cancel = true;
}

void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    // add a custom menu item
    RadMenuItem item = new RadMenuItem("My menu item");
    item.Click +=new EventHandler(item_Click);
    e.ContextMenu.Items.Add(item);
}

Find more on how to handle RadGridView context menu in our online documentation

If you need further assistance, I will be glad to help.

Regards,
Jack
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
ContextMenu
Asked by
Ken
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or