Skip to content

Feature Request - Ability to set WPF context menu's style #5242

Description

@chucker

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 ContextMenuStyle on CefSharp.Wpf.ChromiumWebBrowser to set the style beforehand, then if set, have CefSharp.Wpf.Handler.ContextMenuHandler apply it
  • or an event ContextMenuCreated in CefSharp.Wpf.Handler.ContextMenuHandler which I can listen to

Describe alternatives you've considered

  • implementing IContextMenuHandler myself (or inheriting from CefSharp.Wpf.Handler.ContextMenuHandler. However, that seems like a lot of error-prone work.
  • using CefSharp.Wpf.Handler.ContextMenuHandler but overriding RunContextMenu to grab the created ContextMenu. 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 open PR exists on the CEF Pull Requests and I'd like to propose this feature is added to CefSharp when/if it's merged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions