WPF WebBrowser Control Sample


Want to learn how to host web content in WPF, load Word Docs into WPF, etc? How about calling HTML script and Word from WPF and vice versa? Attached is a simple sample that demonstrates using the WebBrowser control to host content. Specifically, it shows the following:



  • Navigating on the web (e.g. navigating to websites, going back and forward in the history, refreshing the page).

  • Bridging WPF and HTML — Control the WPF application from hosted HTML script and call HTML script using WPF.

  • Bridging WPF and Microsoft Word — load a Word page into the WebBrowser and then using WPF save the Word File.

  • Demonstrates use of most of the WebBrowser control’s members.

WebBrowserSample.zip

Comments (2)

  1. small_mountain says:

    When you said "load Word docs into WPF", what did you mean?  I have Office 2007 installed, and so I’m using the Office 2007 Word PIA, and when I click the "Load Word Doc" button, Word launches externally, not inside the WebBrowser control in the Window.  That’s not what I expected.

    Thanks,

    Eric

  2. Yes, unfortunately Office 2007 disables the in-place navigation to documents. See http://support.microsoft.com/kb/927009/.