After all the requests I decided to create a Firefox workaround as well. It wasn't extremely complicated but it does add another layer of logic, especially when using a XAML context menu as you need to fire an event that the browser can capture to do a little clean up work.
After all the requests I decided to create a Firefox workaround as well. It wasn't extremely complicated but it does add another layer of logic, especially when using a XAML context menu as you need to fire an event that the browser can capture to do a little clean up work.
The first thing I did was I added another Div that was exactly like the SilverlightControlHost Div but was transparent with a zIndex of 99 (the zIndex must be higher than your Silverlight control Div). I set it's display to "none" and it's visiblity to "hidden" so that it wouldn't interfere with Internet Explorer.
I then added the RTLRightClickFix function to this Div and set the Div to "block" display and "visible" visibility. It will now pickup the events in Firefox and we can stop the propagation/event bubbling/whatever it is called in Firefox at this new Div so the Silverlight control Div never even knows about the right click.
When the right click occurs, I hide the Div and display the requested context menu (if there is none to display I show the Div again). Then in the HTML version I just show the Div when the HideMenu() function is called.
For the XAML version it is a little more complicated, I had to add an event that the ManagedCode would fire when the Context Menu was no longer needed. The browser then catches this event and re-displays the transparent Div so that it'll pick up the next right click.
You can view a demo and download the source here: http://www.RealTimeSilverlight.com
Feel free to email me with any feedback: Ken@RTLogicSystems.Com
* Please Note *
This is a proof of concept - not a full blown solution. To make this practical using Firefox you'll need to rework the solution as it will block your left mouse clicks as is. The simplest way would be to create a mechanism to shadow your controls with Divs that need to right clicked. This way, if the right click occurs you are covered, if a left click occurs then your shadowing Div will catch it and can call the click event in your Silverlight app for that control. You can easily add a method to your Silverlight objects that will automatically update the client when they move. Another option is to use the all encompassing Div in the example code, capture your left clicks with it, and then call a HitTest function like the one provided to check if anything was clicked in your Silverlight app.
Either way - you'll still have some additional work to do so it really depends on how important this feature is to you.