R – Silverlight vs WPF

netsilverlightwpf

My organization is considering which technologies to use for our next generation of systems. We will be using .NET, but have not decided which user interface technology is best. Silverlight and WPF seem to be the most appropriate options. Can someone share the pros and cons of each approach?

Best Answer

As Gabriel (and Reed) mention, Silverlight is a slimmed down version of WPF.

WPF is intended primarily for desktop applications, and it has advanced features around layout, animation, and data binding that Silverlight does not yet have. WPF can be delivered via a browser, but it does not run as a browser plug in, and so cannot interact with any other content in the browser. It is possible to create WPF applications that host WinForms controls and windows - this can make it easier to transition a portfolio of existing WinForms code (if that matters to you). WPF also has more sophisticated 3D capabilities than Silverlight - though not by much.

Siverlight, is available on multiple platforms (like Linux and OSX) via the Mono runtime and the Moonlight port of Silverlight. Silver light can either run as a stand-alone app, or within a browser environment - which makes it possible to create web-based applications. When run as a browser-based plugin, a Silverlight app can interfact with the content in the browser, and can be displayed side-by-side with HTML. You can also manipulate a Silverlight app using JavaScript - creating a near-seamless programming environment. There are some limitations in Silverlight apps - for instance, WCF calls are all asynchronous (due to the Silverlight/Browser threading model). Also, not all of the .NET framework SDKs are available to Silverlight apps.

Both technologies are very similar in that they use a combination of markup and code to deliver functionality. To choose between them, you need to decide whether you are building a browser-based or stand-alone application, whether you want to be portable to other platforms, and whether you need the full suite of libraries available in .NET.

On the development tools front - the best tool out there IMHO is Expression Blend - it has an elegant and powerful UI for visually creating either WPF or Silverlight user interfaces. It also integrates with Visual Studio - which is still a superior development environment (Blend has limited code editing features). There are also tools like Expression Design and Expression Encoder to help with creating graphics and manipulating video for use in both WPF and Silveright applications.