简体   繁体   中英

How to hide WebBrowser context menu

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

将oncontextmenu属性添加到文档正文标签。

<body oncontextmenu="return false;">

Just use

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

i tried this in Windows Applications

Some useful links here , here and another one .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM