Should I use WPF or Silverlight? What’s the future of WPF? So many news on Silverlight, but none on WPF? I’m hearing a lot of questions related to the choice of these technologies. If WPF is renamed to Silverlight+, I think the questions would end
Before its release Silverlight was known by the codename WPF/E. WPF/E = WPF Everywhere. This codename gives the relation between WPF and Silverlight. Of course this name didn’t sound flashy so a different name was found: Silverlight. Good for Silverlight, not so good for WPF.
WPF Everywhere - recent news on Silverlight have been on a strategy shift: Our Strategy with Silverlight has shifted. It’s not exactly “everywhere” anymore. To target every platform, HTML is best. Silverlight has big advantages in media and LOB applications; it has a bright future, a big development team and great features to come. Silverlight is much more feature-rich than HTML. Of course with Silverlight it is necessary to think about the client where the application should run. This is not a big difference to HTML. With HTML it is also important to have different screen sizes in mind to give a good user experience.
What platforms can be used with Silverlight? Silverlight is available on Windows, on the Mac, on the Windows Phone, Nokia Symbian, with Windows Embedded… A Silverlight technology – named Moonlight – is also available on Linux.
There’s something common to these Silverlight technologies. XAML, some controls, writing code with C#, sometimes Visual Basic… [ Developing Silverlight for Windows Phone is soon possible with Visual Basic. ]
Not all the Silverlight controls are available on all platforms. Some are just not there, yet; others don’t make sense on different platforms. With all these Silverlight offers I still want to make use of the platform. So different platform versions of Silverlight support different features. For each of these devices different toolkit exists. From Silverlight with Windows Phone 7 I like to make phone calls, send SMS messages, use the accelerometer for motion sensing, use push notifications… Running Silverlight on the desktop I would like to access the desktop, run elevated to do tasks where more privileges are required, call into Microsoft Office… And I have a bigger screen than on the phone. Did you already use a Windows Phone 7? Panorama controls, the application bar… The user expects specific application behavior on a Windows Phone 7, behavior that is so different to the desktop.
WPF has even more capabilities than Silverlight. Some Silverlight controls are not yet available with WPF, but there are several features that are currently just not possible with Silverlight. Real 3-D, flow- and fixed documents are just possible with WPF…, and the complete .NET Framework can be used. Developing with Silverlight sometimes I’m really missing some core .NET features. Of course I find my way around it, but it would be easier with the full framework. Using the complete .NET Framework, WPF has a big advantage to Silverlight.
So what technology should be used depends on what features are required, what platforms must be supported. Every device has different characteristics and also different usage scenarios. It’s always necessary to build the UI for the client in mind. WPF is the big brother of Silverlight. If the features just available with WPF should be used, WPF is the best option. Expression Blend, Visual Studio, Web Matrix are just some of the products done by Microsoft with WPF. If it’s not clear if the WPF features are required from the start, it is easier to begin with Silverlight and change to WPF instead of the other way around.
Service-functionality can be shared between all these application types. It’s easy to create a service that is used both from WPF and Silverlight clients. Different bindings to these clients can be a good option. And it’s also possible to share assemblies between WPF, Silverlight for the desktop, and Silverlight for the phone. Today that’s possible with a Silverlight 3 class library. Nowadays it’s necessary to be careful not using the APIs that are not available on the targeted platforms. A future version of Visual Studio makes the assembly sharing easier as shown from Shawn Burke in the PDC-presentation 3-Screen Coding: Sharing Code between Windows Phone, Silverlight, and .NET.
I’m seeing WPF just as a big brother of Silverlight. And WPF would have an easier life it it’s renamed to Silverlight+.