0

I want to disable the context menu in my WPF System.Windows.Controls.WebBrowser. How would I do so?

msbg
  • 4,852
  • 11
  • 44
  • 73
  • 1
    The WPF version doesn't support suppressing the menu. You can use the Winforms version of WebBrowser, display it in a WindowsFormsHost. Set its IsWebBrowserContextMenuEnabled property to false. – Hans Passant Oct 14 '12 at 17:34

4 Answers4

4

Adding an oncontextmenu attribute to the document body tag.

<body oncontextmenu="return false;">
2

Just use

// Disable the Context menu inside the web browser
webBrowser1.IsWebBrowserContextMenuEnabled = false;

i tried this in Windows Applications

BOSS
  • 1,828
  • 11
  • 34
  • 60
  • 1
    This answer only applies to `System.Windows.Forms.WebBrowser`, not `System.Windows.Controls.WebBrowser` which is what is requested in the question. – Jan Oct 08 '14 at 09:09
0

Some useful links here, here and another one.

Community
  • 1
  • 1
Rohit Vats
  • 79,502
  • 12
  • 161
  • 185
0

WPF WebBrowser Control has many Touch events that you could capture and handle and potentially stop the ContextMenu from ever popping up. Or you could supply your own ContextMenu for the browser to use.

The preview events are lower down on the page and can be used to intercept events that would cause the context menu to pop-up.

OnPreviewTouchDown

OnPreviewTouchMove

OnPreviewTouchUp

Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93