Programmatically Activate the ContextMenu

8 posts, 1 answers
  1. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 23 Oct 2009 Link to this post

    I trying implement a Shift-F10 key to activate the ContextMenu.  I have the Key trapped inside the KeyDown Event, but I don't know how to activate the ContextMenu.  RadGridView.ContextMenuStrip is Nothing.

    2009Q2 (2009.2.9.729), VS 2005 (v8.0.50727.762 SP.050727-7600), .Net2 (2.0.50727), XP SP3, Core2Duo 2.99GHZ with 3GB.



  2. Answer
    Jack
    Admin
    Jack avatar
    2333 posts

    Posted 28 Oct 2009 Link to this post

    Hello Tom,

    The context menus of RadGridView depend on the currently selected cell. So, you can call ContextMenuManager.ShowContextMenu method with the CurrentCell as parameter to show the context menu. Here is the code:

    void radGridView1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Shift && e.KeyCode == Keys.F10 && this.radGridView1.CurrentCell != null)
        {
            this.radGridView1.ContextMenuManager.ShowContextMenu(this.radGridView1.CurrentCell);
        }
    }

    This is a useful feature and I will be added in our feature requests list. I updated also your Telerik points. If you have any other question, feel free to ask.

    Greetings,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 29 Oct 2009 Link to this post

    Thanks for the workaround and the points.

    Couple of Issues:

    1. For some reason "ContextMenuManager" doesn't show up on the Intellisense menu when you're first typing it in.  The only thing under my RadGridView variable that starts with "ContextMenu" which showed up was "ContextMenuStrip".  When I type the "m" after "ContextMenu", all of a sudden both "ContextMenu" and "ContextMenuManager" showed up!?!  Go figure.

    2. I had to handle the scenario of the Apps Key also (i.e. where e.KeyCode = Keys.Apps and all the Key Modifiers are false).  I was surprised I had to do so since Shift-F10 had been supported as the Context (Right-Click) Menu's Shortcut Key in every Windows app I've seen long before the Apps key begin popping up on keyboards.  Since then every Windows app I've seen supported the new Apps key, so I just assumed the new Apps key emulated, via hardware and / or keyboard driver, the Shift-F10 combo (for backwards compatibility).
  5. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 04 Nov 2009 Link to this post

    Hello Tom Chien,

    Thank you for getting back to us.

    I am afraid that I can only guess what is the reason for the weird intellisense behavior. We have no other customers' complaints about missing properties and probably the issue is related to your current installation of Visual Studio.

    I confirm that you have to handle Apps Key separately. We will consider to add this as standard functionality.

    Thank you once again for the participation. Do not hesitate to contact us again if you have any other questions.

    Greetings,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 04 Nov 2009 Link to this post

    1. My colleague has experienced similar Intellisense problems.  He thinks it started after SP1 of VS2005, so it's probably not Telerik-specific.
  7. Nick
    Admin
    Nick avatar
    767 posts

    Posted 06 Nov 2009 Link to this post

    Hello Tom Chien,

    We think the same as well, our controls cannot be a reason for an intellisense problem in VS. Perhaps it is a bug of Visual Studio. 

    Regards,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Damian Andrade
    Damian Andrade avatar
    2 posts
    Member since:
    Sep 2009

    Posted 16 Nov 2009 Link to this post

    I have same problem, but no t is problem Visual Studio, see image
  9. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 20 Nov 2009 Link to this post

    Hello Damian Andrade,

    It seems that you are using our WPF controls, but not the WinForms suite. However, we are discussing the WinForms suite in this forum thread. If you have any issues with the WPF suite, please open a new forum thread in the WPF forum section.

    Best wishes,

    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WinForms is Visual Studio 2017 Ready