Reputation: 731
Hi I'm developing a WPF application. I need to display some HTML content from a Web Page on one of my WPF forms. What should I use, what is the best way to do this? I found 2 possible solutions but don't know which is the best.
Use a FlowDocumentReader and then create a FlowDocument control or Use a DocumentViewer control and then create a FixedDocument control or any other advice.
Thanks in advance!
Upvotes: 1
Views: 3120
Reputation: 95
You can use the WebBrowser control but please do not use it - it is filled with memory leaks and does not dispose propoerly. I have spent lots of time looking for solutions to the problems it produces in production code to no avail.
A quick search on this site will show some of the "unsolved" issues becasue basically it is a wrapper for a COM object (hence unmanaged) version of Internet Explorer and while it seems to work beautifully for displaying an embedded page in WPF the problems far out weigh its appearance of simplicity.
Many have suggested using HTTP transfers to get your content and then convert it and display it as a flow document as you are investigating here. After laboring with the WebBrowser memory and dispose issues for far too long I ended up changing to use the FlowDocumentScrollViewer control and havent looked back since.
Upvotes: 6