cefsharp / cefsharp/CefSharp

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

Aperta
#5,242 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
feature-request up-for-grabs
Lingua principale
C#
Stelle
10.3k
Fork
2.9k
Merge medio
5g 22h
PR unite (30g)
4

Descrizione

**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:**
- [x] I have reviewed the [CEF API](https://magpcss.org/ceforum/apidocs3/index-all.html) 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](https://bitbucket.org/chromiumembedded/cef/pull-requests/) and I'd like to propose this feature is added to `CefSharp` when/if it's merged.~~

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con CefSharp.Wpf.Handler.ContextMenuHandler e CefSharp.Wpf.ChromiumWebBrowser, concentrandoti su come viene istanziato il menu contestuale durante RunContextMenu. Confronta gli approcci proposti della proprietà ContextMenuStyle e dell'evento ContextMenuCreated, quindi verifica che uno stile WPF fornito dal consumer venga applicato al menu creato senza richiedere un IContextMenuHandler personalizzato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
desktop
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.