Reputation: 37
I have recently started doing the coding in Silverlight application.I am not having great ideas about it. Now I am having the problem while disable right click Silverlight applications in a HTML page. I have tried to do lot of things but was not succeeded.Please help me how to disable right click on htmlpage using silverlight.
Upvotes: 0
Views: 360
Reputation: 6996
If you could use javascript here is your answer , but generally disabling the right click is not recommended.It will annoy some users.
<script type="text/javascript" >
var BM = 2; // button middle
var BR = 3; // button right
var msg = "MOUSE RIGHT CLICK IS NOT SUPPORTED ON THIS PAGE";
function mouseDown(e) {
try { if (event.button == BM || event.button == BR) { return false; } }
catch (e) { if (e.which == BR) { return false; } }
}
document.oncontextmenu = function() { return false; }
document.onmousedown = mouseDown;
</script>
Upvotes: 1