Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Menu, Application Menu, Context Menu > context menu keeps focus?

Answered context menu keeps focus?

Feed from this thread
  • Ken avatar

    Posted on Jan 13, 2012 (permalink)

    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?

    Reply

  • Answer Jack Jack admin's avatar

    Posted on Jan 17, 2012 (permalink)

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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Menu, Application Menu, Context Menu > context menu keeps focus?
Related resources for "context menu keeps focus?"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]