Tales From The PDC - Day 1

Blog Bling BrainWell here I am in sunny LA at the PDC. At least I assume it's sunny, not been outside all day. Been too busy 'capturing the brain power' or something...

No doubt by the time I post this you'll have heard something about Azure. Apart from being a rather nice shade of blue it's the name of the new Microsoft cloud platform. I was at the key note when Ray Ozzie announced Azure and went through the end-to-end Microsoft Software + Services strategy. I have a post in prep, but there was a lot of interesting stuff in the keynote so it's going to take a while to turn my notes into something coherent. And there's even more to come at tomorrow's keynote apparently...

Apart from the keynote I spent most of the day manning the P&P booth in the pavilion, but I did manage to catch one session this afternoon. Ian Ellison-Taylor (GM of WPF and Silverlight) did a session on "sharing skills and code between WPF and Silverlight", a topic that interests me and the Prism team a lot.

Well the room (and it was a big room) was standing room only, so I guess there is a lot of interest in this topic. Ian spent a couple of minutes talking about why we need both WPF and SL, the different scenarios that they address, and their different technical constraints caused by the different operating environments.

To illustrate the compatibilities (and incompatibilities) between WPF and SL, he built a Twitter client in both Silverlight and WPF. He started two projects and then basically just copied code from the WPF project and pasted it into the SL project and pressed F5. For the most part this worked great, highlighting the high(ish) level of compatibility between WPF and SL.

First hurdle was the sandbox - the Silverlight client couldn't just call the Twitter service directly due to cross-site call restrictions, so it had to redirect the call through the server. This is not really a compatibility issue, more of an architectural issue caused by the security characteristics of the two environments.

Next hurdle was the lack of Visual State Manager support in WPF. Happily this will be added to WPF in the next release though. In the meantime, it will be available as part of the WPF Toolkit on CodePlex, or you can grab a working WPF VSM from John Gossman's blog. The VSM really simplifies styling, is very nicely supported by Blend, and makes up a bit for the lack of triggers in Silverlight.

Even with a VSM on WPF, control styling behavior may not be exactly the same as in Silverlight. To complete the picture you may need to write a Visual State Behavior for your control. This hooks the control up to the VSM so the states can stay in sync. The Silverlight controls do this automatically but the WPF controls predate the VSM so you need an adapter to hook them up. It looks like the WPF Toolkit contains Visual State Behaviors for some of the controls but not all, so you might have to add a few more. Luckily it looks like they are pretty easy things to write...

There are a couple more compat gotchas of course, but the key thing is that the WPF and Silverlight teams are taking compatibility very seriously, so any kinks will hopefully get ironed as time goes on...

Day 1 is wrapping up now, which means it's nearly time time to meet up with fellow geeks in a hotel bar, drink beer, and capture some more brain power  :-)