Feature Request - Ability to set WPF context menu's style
Author: chuckerCreated May 4, 2026Updated May 8, 2026
Labelsup-for-grabsfeature-request
Describe the solution you'd like
I moved from IContextMenuHandler to CefSharp.Wpf.Handler.ContextMenuHandler in order to avoid #1882.
As a result, the context menu now has the default WPF styling, which doesn't really fit Chrome or modern Windows.
I would like to be able to set the context menu's Style property; however, the context menu is instantiated ad-hoc, so this doesn't seem possible. I.e., I would like
- either a property
ContextMenuStyleonCefSharp.Wpf.ChromiumWebBrowserto set the style beforehand, then if set, haveCefSharp.Wpf.Handler.ContextMenuHandlerapply it - or an event
ContextMenuCreatedinCefSharp.Wpf.Handler.ContextMenuHandlerwhich I can listen to
Describe alternatives you've considered
- implementing
IContextMenuHandlermyself (or inheriting fromCefSharp.Wpf.Handler.ContextMenuHandler. However, that seems like a lot of error-prone work. - using
CefSharp.Wpf.Handler.ContextMenuHandlerbut overridingRunContextMenuto grab the createdContextMenu. This doesn't (seem to) work reliably due to timing issues.
Checklist:
- I have reviewed the CEF API and have confirmed the feature I'm requesting is possible.
- [ ] The Feature I'm requesting is an improvement to Async Javascript Binding (No new feature are being added to the Sync Javascript binding)- [ ] An openPRexists on the CEF Pull Requests and I'd like to propose this feature is added toCefSharpwhen/if it's merged.
Source: cefsharp/CefSharp