views:

1197

answers:

4

It seems like a common question on Google, but I couldn't find a satisfactory answer (unless the answer is 'no')

I would like to add menu items or show a custom menu when a user right-clicks on my Silverlight app.

The closest thing that I found catches the context menu in IE, but not in Firefox, and Chrome shows the context menu and then shows the custom event.

(The tutorial I mentioned was here http://silverlight.net/blogs/msnow/archive/2008/07/01/tip-of-the-day-14-how-to-right-click-on-a-silverlight-application.aspx)

A: 

I've come to the conclusion that it seems it is possible based on my use of Telerik's context menu which works fine on IE, Chrome and Firefox.

Check it out, http://demos.telerik.com/silverlight/#ContextMenu/FirstLook

Andy Britcliffe
+2  A: 

There is no way to do this natively in Silverlight.

I believe that the Telerik control noted elsewhere uses the HtmlBridge to intercept the context click, then draw their own menu, however it does not appear to be working with Silverlight 2.0.40115 now, so maybe Microsoft have closed that gap.

Having no right click is a design decision based on security concerns, rather than a technical one. However I believe that the Microsoft team are considering allowing context menu's in future versions (perhaps even v3)

Ian Blackburn
I think its based on user experience concern too... No right click --> no hidden functionality
Peter Gfader
+2  A: 

Hi,

Here you have an implementation but it's CTRL+Left click, then you get a context menu (about the text, sorry it's in spanish):

http://www.albloguera.es/?p=29

Another option, is the one pointed out do it via javascript, quite chunky solution, and not sure if now it's working in the current 2.0 version :-(.

Good Luck Braulio

Braulio
A: 

Hi andybritcliffe,

I'd be interested to know how you got rid of the default menu.

Did you manage to get the same behavior as in their demo? Did you have to call any special handlers in addition to using their custom controls?

Thanks

Gromix