context menu keeps focus?

2 posts, 1 answers
  1. Ken
    Ken avatar
    10 posts
    Member since:
    Sep 2011

    Posted 13 Jan 2012 Link to this post

    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?
  2. Answer
    Jack
    Admin
    Jack avatar
    2333 posts

    Posted 17 Jan 2012 Link to this post

    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).

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top