Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Right-click handling with windowless=false
3 replies. Latest Post by lingbing on January 13, 2009.
(0)
Tolik2
Member
6 points
36 Posts
12-26-2008 3:56 AM |
Is it even theoretically feasible to enable mouse right-click handling with windowless=false ? Every sample I've seen so far requires windowless mode, but then there are multiple limitations that get introduced. Flash seems to have easier model for introducing custom context menus for example tha work in all browsers/platforms. Any ideas on better solutions in Silverlight?
lingbing
Contributor
2249 points
406 Posts
12-26-2008 8:54 PM |
Remember browser doesn't know what is java and C#, it can only know what is javascript. So the event provide by browser is a javascript event. Whether an application running on browser supports mouse right click event or not is only according to if it present the event to developers.
When we want to handle right-click event, we must use System.Window.Browser.HtmlPage.Document.AttachEvent to attach the eventhandler for the javascript event oncontextmenu. And the limit that we have to set the windowless as false seems there is no way to avoid it.
Some people tell me that in MacOS, there is not the meaning of mouse right-click, I never use that. But both flash and silverlight don't support right-click defaultly, maybe this is the reason.
Regards!
01-13-2009 3:27 AM |
I beg to disagree with you on last point Ling. Flash does use right-click pretty well - it allows you to add custom menu items to its context menu and yes that value is available on Mac - it's just Ctrl-click not right-click, which is also unavailable in Silverlight.
01-13-2009 4:26 AM |
Thanks, I've never used MacOS, you tell me the fact.
The flashes (swf file) I have seen in some pages, when I right-click on them, the show Adobe-Flash-Configurations, which is just like Silverlight-Configuration. I have seen some applications have right-click support, but I didn't read their code.