2

I would like to deactivate the right click in my app that offers the option to install the app on the desktop. How do I do such thing?

ebcrypto
  • 610
  • 1
  • 14
  • 28

2 Answers2

4

Right click on the project in Visual Studio and select properties. There is a check-box "enable running out of browser" option there.

KeithMahoney
  • 3,323
  • 19
  • 10
2

Here's a hackish way to do it for older versions of SilverLight from a silverlight forum:

<div id="silverlightObjDiv">
    <!-- silverlight object here -->
</div>
<script>
document.getElementById('silverlightObjDiv').oncontextmenu = disableRightClick;
function disableRightClick(e) {
    if (!e) e = window.event;
    if (e.preventDefault) {
        e.preventDefault();
    } else {
        e.returnValue = false;
    }
}
</script>

If you are using a recent version, you can disable this behavior from the properties of your project.

Michael Goldshteyn
  • 71,784
  • 24
  • 131
  • 181