WPF WebBrowser control looks great but knowledge accumlated over time about WinForms WebBrowser is substantial and it's hard to ignore work like csExWB. It would be nice to know what functional shortcomings or advantages exists in .NET 3.5's WPF WebBrowser control over WinForms WebBrowser control. In particular, is it possible to build csExWB-like functionality on top of WPF WebBrowser?
From one full day of frustration with wpf's component, here's what I discovered. Apparently, winforms webbrowser exposes much more methods and properties. For instance, there's no IsWebBrowserContextMenuEnabled
, ActiveXInstance
, etc. in wpf webbrowser.
Also, the document
property of each contains different types of objects. Winform contains a document of type System.Windows.Forms.HtmlDocument
with a few interesting methods and properties like PointToClient
and GetElementFromPoint
. Wpf webbrowser document is an Object
type document that can be cast to mshtml.HtmlDocument
, which only provides the same methods and properties available from a standard html + javascript document. Not very exciting. I don't know if it can be cast to something else (useful that is) since there's no real documentation about it.
The only disadvantage I could notice about winforms webbrowser is that the buttons and scrollbars inside the component don't have the same appearance as the wpf native controls.
I must admit I don't know the differences, but if you hit problems you could perhaps use WindowsFormsHost to host the winform version in WPF, like so? Ultimately, both is a wrapper around shdocvw, so principles like "pure WPF" don't really apply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With