How do I load HTML into Webbrowser control for WPF?
.net, c#, webbrowser-control, wpf
Solution
Actually, there is such a thing as an HTML page with embedded images.
You can embed both images and CSS inside an HTML string, using the data URI scheme. However, not all versions of IE support this, and the WebBrowser control is really IE. If your code might run on a machine with IE < 8, this approach won't help you.
Another option would be to store your images and CSS as embedded resources, write them out to temp files, and then insert absolute URL's to the temp files when you generate your HTML.
Problem
My WPF client application is building a custom HTML page, I can load the HTML like this, ``` this.myWebBrowser.NavigateToString("<html><body><p>test page</p></body></html>"); ``` The problem I have is how do I load custom HTML into the Webbrowser control, if the HTML has images and css file in it? How do you reference the images and css? Can the images and css be embedded into the application, or do they need to be in a directory somewhere? Thanks for the help.