Hosting browser in WPF

耗尽温柔 提交于 2019-12-22 04:27:11

问题


Is it possible to host any other web browser beside IE in WPF desktop application?

Edit:

If yes, how?


回答1:


There is a WPF control available for hosting an instance of Google's Chrome browser: http://chriscavanagh.wordpress.com/2009/08/25/wpf-chromium-webbrowser-source-code/




回答2:


Not without creating your own custom host and the associated interop.

The WPF WebBrowser control uses the COM interfaces exposed by IE to work. If you want to use Firefox or Webkit, you'd need to build a managed wrapper for the browser (or find one, I suppose) and then wrap this in a WPF user control. This wouldn't be trivial since these browsers likely use GDI/GDI+ to do drawing and an HWND for window management, which can work with WPF, but you have to work through a lot of interop issues.

I've thought about doing this myself, but then thought that it might be just as easy (given my limited purpose at the time) to create a new WPF-based browser using Document, since then it could participate in WPF transformations and animations and expose the DOM to the visual tree natively.




回答3:


You can host, Chromium browser (WebKit) using http://code.google.com/p/chromiumembedded/

Check out the links there is a link to .NET/Mono wrapper https://bitbucket.org/xilium/xilium.cefglue/wiki/Home



来源:https://stackoverflow.com/questions/1140363/hosting-browser-in-wpf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!