PDC 2008, Day #1, Session #4, 1 hr 15 min.
This session focused on sharing code between WPF and Silverlight applications. How easy is it to take an existing WPF application and run it in the cloud by converting it to Silverlight 2? Conversely, how easy is it to take a Silverlight 2 application and run it locally as a WPF application?
The bottom line is that it’s really quite easy to run the same application as either a local WPF application or a cloud-based Silverlight 2 app, with just a few modifications.
Ian started with a quick summary of when you’d want to use WPF vs. Silverlight 2:
- WPF: best for desktop apps needing maximum performance and leveraging 3D graphics on the desktop
- Silverlight 2: best for RIAs, smaller and lighter, able to run on various platforms and in various browsers
One of the more interesting parts of the talk was Ian’s description of the history of Silverlight 2. We know that Silverlight 2 uses a smaller version (much smaller) of the .NET Framework, which it deploys via the browser, if a client needs it.
But Ian described how, in the first attempt at a Silverlight 2 framework (WPF/e at the time), they started with the full framework and started pulling stuff out. They quickly found, however, that it made more sense to start with a clean slate and then only pull in the bits that they needed for Silverlight 2.
Applications written in WPF or Silverlight 2 can be moved to the other platform fairly easily, but Ian said that it was a bit easier to convert Silverlight 2 apps to run as WPF than the other way around. This makes sense—WPF apps might be using parts of the full .NET framework that aren’t supported in the Silverlight 2 subset.
Also interesting, Ian suggested that developers start by learning Silverlight 2 and then moving to WPF, rather than the other way around. Things are done in Silverlight 2 in a much simpler way, so the learning curve will likely be shorter. As an example, he talked about the property system, which is far more complex in WPF.
This was an excellent talk, with some nice demos. Ian worked simultaneously on a WPF and a Silverlight 2 application, adding features to one and then moving them over to the other platform. It was an excellent way to highlight some of the differences and the gotchas that developers will run into. But it also showed off how similar the platforms are and how easy it is to migrate an app from one to the other.