JenniLe JenniLe

Niner since 2008


  • WPF 3.5 SP1 App Model with Jennifer Lee

    Hi Matt,

    Yes, that sounds like the right thing to do. You might also try writing a custom control that has a child WebBrowser, if you want encapsulation.

    We are working on putting together some WebBrowser samples, and I think the RSS scenario would be a good one, as well.

  • WPF 3.5 SP1 App Model with Jennifer Lee

    Soooo... (point taken) Wink

    I'm taking this to mean you want to be able to bind an HTML string to some property on the WebBrowser and cause the WebBrowser to navigate when the data bound to the property is updated.

    A few things here -

    Yes, the WebBrowser control is a DependencyObject. However, we would have to expose navigating to an HTML string as a property (specifically, a DependencyProperty) for the databinding to work, and for it to work in XAML, which we do not. The functionality of navigating to an HTML string is achieved by calling the WebBrowser.NavigateToString() method. You will need to implement your scenario in code by calling the NavigateToString() method. 

    Therefore, the answer is NO, you could not do this:
    <WebBrowser DocumentText="{Binding MyHtmlProperty}" />

    I can see how the above would be useful and convenient. The change would mean you could 'get' the html string loaded as well as 'set' it (which is what the method achieves). We may look into adding it for a future release. As always, your feedback and specific affected scenarios certainly help in these matters, so please keep it coming!