Question

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)

Was it helpful?

Solution

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

OTHER TIPS

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)

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top