A richer web experience with WPF and XBAPs

If you already know what an XBAP is, jump to the samples (eg a clock, a blackjack game, etc) at the end of this post. If you don't, then read on...

Although an increasing number of people are aware of the Windows Presentation Foundation (a component of WinFX), the perception is that this is exclusively a client technology and has no place in the world of the browser.

This misconception, where it occurs, is an important one because it misses one of the points of WinFX - the blurring of the boundaries between web applications and client applications. Simply put, a WPF application can be made to run in a browser, and therefore enjoy all of the ease of deployment and update benefits that normal web applications have, with a flip of a software switch. When the switch is off, the application behaves like any "normal" Windows application and is installed and run locally on your machine (with all of the benefits of WinFX of course). But when the switch is on, the application can be run from within a browser. It's important to note that this is exactly the same code - it isn't a "web version" and developers don't need to write two versions of the code.

So this sounds great but there's an obvious caveat, that of security: A browser-accessed WPF application will have far fewer rights in terms of what it can do with your machine and will run in a security sandbox. Obviously this will limit what you can do with the applications - they can't access the local hard drive for example. However there may be some instances, eg in your intranet, where you want these apps to have full trust. Karsten Januszewski's blog shows how this can be done.

After a few fumbles with names we've settled on XAML Browser Applications (XBAP) for these kind of WPF apps. See Tim Sneath's blog entry about the naming history and for some examples - also listed below.

The good news is you can see this in action right away: If you're running Windows XP you download & install the WinFX Runtime Components (from here), you can just click on the links below to see a WPF application running inside your browser - IE only.

The first two have been produced by the excellent 3rd party vendor MobiForm using their Aurora development tool:

Valentin Iliescu has done some great work in this space. He demonstrates with this example how WPF vector graphics scale, and how you can represent unusual text like mathematical equations without resorting to bitmaps (as you would if you were using HTML).

It's worth visiting Valentin's website for more information, and also to take a look at his 3D Chess game. He's had this available as an XBAP application for some time but has not yet updated it for the latest CTP but you can check out some screenshots and a video to get an idea of how it works.

Finally, I have compiled up one of the SDK samples and made it available to run here - it's a Blackjack card game.

If you come across any other XBAP apps, or indeed have written one yourself, let me know.