简体   繁体   中英

CefSharp WinForms browser hosted within WPF WinFormsHost

I'm currently working on moving out kiosk software that runs Awesomium away and instead onto CefSharp. Our main application is written in WPF and this work is using v45 of CefSharp

I'm aware that the WPF control has some serious performance issues, when compared side-by-side with the WinForms version hosted in a WindowsFormsHost, the smoothness of transitions etc is MUCH better.

To that end I'm looking to stick with this approach of embedding the WinForms ChromiumWebBrowser inside a WindowsFormsHost on the WPF window. This all works and however I'm having issues with getting touch support to work. Our kiosks have touch screens and run Windows 7 / 8.1, the touch works flawlessly with the WPF control, however when using the WinForms embedded one touch doesn't work at-all. As well as touch not working it also steals all Keyboard events and consumes them internally it seems, as none of my event handlers ever fire on the main WPF window.

If anyone has any ideas or can point me in the correct direction to try and solve this it would be hugely appreciated!

Thanks

The scenario your talking about is not well supported and as such there is not a lot of information. A lot of the problem your are seeing are likely because CEF is running it's message loop in a separate thread. If you turn MultiThreadedMessageLoop off, then you become responsible for calling Cef.DoMessageLoopWork() . I recently added a rough demo the WinForms Example . You can likely port this to WPF , though I've never tried.

You are in somewhat uncharted territory there, so you'll have to do most of the leg work yourself.

For reference there are some ways to improve the WPF performance. They come with their own set of drawbacks though. See https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp.Example/CefExample.cs#L58

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