Home » Web Experiments

XBAP RSS Reader

9 November 2006 One Comment

So I’ve been playing with Windows Presentation Foundation using Expression Interactive Designer and C#. It’s a lot of fun and the results are worth the extra little digging I’ve had to do due to it being in Beta. For some reason I’ve taken to this far easier than ActionScript and Flash.

I wrote a simple RSS reader which you can access here [LINK]

Remember you’ll need WPF via .NET 3.0 [LINK] and IE 7.0 [LINK] to run this.

If you are playing with WPF and want to deploy an XBAP application to your server, remember to setup the MIME types as described here [LINK].  Failure to do this will yield very confusing 404 errors when you browse the page.

For the RSS reader I ran into two major hurdles. The first was how to convert HTML contained in my RSS Items to XAML in the form of a FlowDocument. This is not a trivial task but I found a XAML/HTML Converter [LINK]. Unfortunately the parsing of image tags wasn’t implemented but I found it a trivial effort to put that in there.

The second was how to bind declarative controls in XAML data that had been processed (e.g. HTML converted to FlowDocuments). This I accomplished through a thing called the IValueConverter interface. You implement this interface to convert your data, then in the binding you specify this as the formatter like so:

     Text="{Binding Converter={StaticResource HtmltoXamlStringConverter}, Mode=Default, XPath=description}"

Easy when you know how right? I’m going to start posting code for this stuff in a day or two when I get my Code Browser ironed out.
Enjoy.

One Comment »

  • Marcelo said:

    Can you please send me (or post) the modified source code of HtmlToXamlString in order to support the images on the html code ?

    Thanks !!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.