9. May 2009 18:10
In an earlier post, I created a small extension library that added several mouse gestures to Silverlight. However, the right-click only worked in Internet Explorer, and the solution was a bit of a hack. So to continue down the road of hacks, I found that there is a way to prevent the Silverlight Plugin from getting the right click event. By inserting a <div> on top of the plugin when the right mousebutton down event fires, you can prevent the mozilla browsers from getting the rightclick event. The mouseup event is then fired on this overlay div, and we remove the overlay again when the button is released or the mouse moves. Ugly but it works... The approach still requires the plugin to run in windowless mode.
Of course whether you even should be preventing the user from getting to the silverlight context menu in the first place is a whole different discussion.
I've updated the demo page, source and binary:
Try a demo!
Download binary (7 kb)
Download source (25 kb)