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

Programmatically Activate the ContextMenu

7 Answers 414 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tom Chien
Top achievements
Rank 1
Tom Chien asked on 24 Oct 2009, 03:38 AM
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.



7 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 28 Oct 2009, 10:28 AM
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.
0
Tom Chien
Top achievements
Rank 1
answered on 29 Oct 2009, 05:38 PM
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).
0
Martin Vasilev
Telerik team
answered on 04 Nov 2009, 12:59 PM
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.
0
Tom Chien
Top achievements
Rank 1
answered on 04 Nov 2009, 03:59 PM
1. My colleague has experienced similar Intellisense problems.  He thinks it started after SP1 of VS2005, so it's probably not Telerik-specific.
0
Nick
Telerik team
answered on 06 Nov 2009, 02:37 PM
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.
0
Damian Andrade
Top achievements
Rank 1
answered on 16 Nov 2009, 09:09 PM
I have same problem, but no t is problem Visual Studio, see image
0
Martin Vasilev
Telerik team
answered on 20 Nov 2009, 08:10 AM

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.
Tags
GridView
Asked by
Tom Chien
Top achievements
Rank 1
Answers by
Jack
Telerik team
Tom Chien
Top achievements
Rank 1
Martin Vasilev
Telerik team
Nick
Telerik team
Damian Andrade
Top achievements
Rank 1
Share this question
or