InfoQ

News

WPF vs. Silverlight – What Really is the Difference?

Posted by Jonathan Allen on Nov 08, 2009

Community
.NET
Topics
Rich Client / Desktop ,
Rich Internet Apps ,
Silverlight
Tags
WPF

As both WPF and Silverlight increase in importance among .NET developers, the confusion about the difference between the two has also increased. Back in June Wintellect released a little known but incredibly important whitepaper on the topic simply titled Microsoft WPF-Silverlight Comparison Whitepaper. While we recommend GUI developers read all 69 pages, we offer you a summary of the major ones that impact line-of-business developers.

Dependency properties are a key component of both platforms, with PropertyMetadata being used to back properties instead of normal fields. While Silverlight only offers this one class, WPF has some subtypes.

  • UIPropertyMetadata adds a flag that determine “whether animations should be disabled on the dependency property where the containing metadata instance is applied.”
  • FrameworkPropertyMetadata adds flags to indicate the property affects the pipeline including control arrangement, measuring, rendering. It can also indicate whether or not data binding is allowed on the property and what type to default to. Since Silverlight doesn’t support this class, all data binding defaults to one-way.

Silverlight doesn’t support tunneling events. Both platforms support direct and bubbling events.

WPF supports several types of triggers. A basic trigger attaches to a dependency property and automatically applies style changes when the trigger condition is met. In addition to basic triggers, WPF also supports triggers that respond to routed events and triggers that work with data-binding. Instead of triggers, Silverlight uses a technology called Visual State Manager instead. WPF doesn’t currently offer this, but will in WPF 4.0.

Silverlight only supports a few markup extensions. In addition to the shared StaticResource, Binding, and TemplateBinding extensions, WPF adds DynamicResource, RelativeSource, x:Type, x:Static, and x:Array.

There are numerous keyboard and mouse events only available in WPF. As there are far too many to list here, we will defer to the full text.

UIElement class and the IInputElement interface. When a control is disabled, WPF uses this to disable all of the child controls. Silverlight doesn’t offer this behavior, so developers have to walk the control tree manually.

On the communication side, WCF in Silverlight is limited to BasicHttpBinding and PollingDuplexHttpBinding. WPF, of course, supports all of the available bindings.

Finally, printing is completely different in WPF and Silverlight. WPF allows the direct printing of visual trees while Silverlight relies on the browser.

More on the subject by Alan Mendelevich Posted Nov 9, 2009 3:04 AM
Re: More on the subject by Jonathan Allen Posted Nov 9, 2009 3:26 AM
  1. Back to top

    More on the subject

    Nov 9, 2009 3:04 AM by Alan Mendelevich

    I'm currently writing a series of blog posts on code reuse between WPF and Silverlight. Table of contents can be found here.

  2. Back to top

    Re: More on the subject

    Nov 9, 2009 3:26 AM by Jonathan Allen

    I'm looking forward to reading it, the source I cited was released before Silverlight 3 was complete and needs to be updated with the final feature set.

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.