views:

224

answers:

3

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?

+2  A: 

Silverlight is a subset of WPF that is used in the Silverlight browser plugin. Both are good, but you have to decide whether you'll end up with a web-based or a windows application.

Silverlight doesn't have all of the capabilities that WPF does (partially for security reasons - it is used in the browser). With Silverlight, though, you have access to all of the rest of the web based application advantages (single upgrade location, etc. - JavaScript, CSS, and HTML).

Gabriel McAdams
SilverLight can now also run out-of-browser
CraigS
+3  A: 

Silverlight is far less capable than WPF, even in version 4.

It can run in a browser or out of browser, and has some advantages - but the main advantages of Silverlight over WPF are deployment related. It is very easy to deploy a Silverlight application - just refer to the XAP in a webpage located on your server, and it's deployed (provided your users have Silverlight installed). WPF requires a bit more work in terms of deployment, since it's a full desktop application.

That being said, WPF provides far more capabilities. It provides access to the full .NET framework (as opposed to a [growing] subset).

My personal preference would be to use Silverlight - provided the application did not require interop with legacy software, access to resources on the system, or other things unavailable within Silverlight. If, however, you need to do anything that will tax the system (ie: heavy computation where you want parallelism, use of graphics resources, complex 3D work, etc), then WPF is the way to go.

Reed Copsey
Thanks Reed. I imagine some of those unavailable functions (such as interop) could be accomplished with SilverLight via the use of WCF?
CraigS
You're not really using Silverlight, then - you'd be moving that into a separate application. In SL4, you can use COM hosting (out of browser only) to accomplish some of this, but at that point, WPF is just plain nicer to work with. If you want a single app, and need interop, go WPF...
Reed Copsey
+1  A: 

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.

LBushkin