0

How to disable context menu in cef sharp chromium browser and replace a new custom context menu that consists of only buttons

4
  • Possible duplicate of How do I hide the CefSharp.WinForms.ChromiumWebBrowser right click context menu? Commented May 22, 2019 at 12:46
  • what have you researched and tried so far?
    – jtate
    Commented May 22, 2019 at 12:50
  • Iam trying to change the looks of the old context menu in cef chromium browser...now the context menu has only text ...Iam trying to put images...for example there is “back” option in the context menu...I must remove it and put a small icon which resembles “back” option
    – Comp Droid
    Commented May 23, 2019 at 18:26
  • That is not supported, you'll have to implement your own menu. If you are using WinForms you can implement cefsharp.github.io/api/73.1.x/html/… then display your own
    – amaitland
    Commented May 25, 2019 at 21:40

1 Answer 1

1

You implement the IContextMenuHandler interface, and then in IContextMenuHandler.OnBeforeContextMenu you call model.Clear();. Then you have to set your ChromiumWebBrowser's MenuHandler property to an instance of your implementation. From the code doc on that method (model.Clear()):

Remove all menu items. Can be used to disable the context menu.

1
  • Yes I have done the same...but I want to add new context menu ....the context menu will have only buttons side by side without any kind of text
    – Comp Droid
    Commented May 23, 2019 at 18:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.