"Those who cannot remember the past are condemned to repeat it." [WebBrowserExtensions.StringSource attached dependency property makes Silverlight/Windows Phone/WPF’s WebBrowser control more XAML- and binding-friendly]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (10)
  1. Martin Krüger says:

    I was trying to add this blog post to my favorites. But it doesn't work. Any idea?

    Adding the home site of your blog to favorites works fine, but not the specific site.

  2. Simone Chiaretta says:

    I'll have to try it: I hope it solves the nasty encoding bug of the NavigateToString in the WP7 WebBrowser (I talked about it in my blog: codeclimber.net.nz/…/WP7-Tip-How-to-correctly-handle-smart-quotes-in-WebBrowser.aspx)


  3. Simone Chiaretta says:

    Just read the code of the extension: I guess the error in the encoding is still here (and here a better solution for that problem: codeclimber.net.nz/…/The-importance-of-performance-testing-in-a-Windows-Phone-7.aspx)

  4. Martin Krüger says:

    Hello David,

    based on your article I created a custom attached dependency property named XamlSource, which can be used to implement data binding for the RichTextBox.Xaml property. You can grab the source code of a demo app here:


    and read an article on how to this demo app was built here:


    The custom attached dependency property works hand in hand with my RichTextBox.Xaml Builder Addin, which one can download here:


    Best regards,


  5. David Anson says:

    Martin KrΓΌger,

    I'm not sure why you wouldn't be able to add this post to your favorites. Unfortunately, that's a feature of the blog hosting software I don't use, so I don't have any good troubleshooting steps. πŸ™

    That aside, what you've done for RichTextBox.Xaml looks very neat! From what I gathered from reading the English translation of your article, the situation there is similar enough that the ideas here work there, too. Great stuff – thank you very much for sharing this! πŸ™‚

  6. David Anson says:

    Simone Chiaretta,

    No, I didn't set out to solve any encoding problem with the StringSource property – I think such things should probably be dealt with at a higher level (i.e., by the caller). And judging from your blog posts, that's exactly what you did! πŸ™‚ Great information – and what's funny is that I ran into pretty much the same problem as I was using the WebBrowser control and solved it similarly. Thanks very much for sharing your work with others! πŸ™‚

  7. Simone Chiaretta says:

    I think the higher level to solve the problem should be the web browser control itself: the funny thing is that the encoding is dealt with correctly if navigating to a URL.

  8. David Anson says:

    Simone Chiaretta,

    I agree – ideally the WebBrowser control would handle this better. πŸ™‚

  9. josheinstein says:

    Couldn't this be done cleanly with a value converter?

  10. David Anson says:

    Joshua Einstein,

    If you're referring to the "sanitization" of the input characters Simone Chiaretta discusses above, I believe you're right that could be done by using an IValueConverter on the Binding for the StringSource property.

Comments are closed.

Skip to main content