views:

28

answers:

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?

+2  A: 

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

KeithMahoney
+1  A: 

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