views:

249

answers:

3

What is the difference between WPF and Silverlight?

Is it just the same as winforms vs asp as in desktop apps versus web app or is there an overlap?

+2  A: 

WPF is a desktop API that is a replacement to the venerable pixel-based GDI Winforms library. It uses XML layout (XAML) and binding, partial classes and is no longer pixel-based (it deals in units so apps still work where the user has the DPI set differently).

Silverlight is a subset of WPF that runs within a browser, much like Flash.

Silverlight 3 extended its reach onto the desktop as a counter to Adobe Air so there isn't much of a gap between Silverlight and WPF to the point where one has to question the future of WPF. See Silverlight 3 might kill Windows Presentation Foundation.

cletus
+5  A: 

Silverlight is a subset of the functionality in WPF. WPF is desktops, silverlight is cross-platform web apps. Silverlight can run out-of-browser with limited functionality. if you want full blown WPF and access to everything WPF can access on the client, you can't do silverlight out-of-browser - just build a WPF app.

WPF and silverlight use XAML at its core to describe the layout. There is a MS document that highlights the differences between the two. I just can't find it right now.

WPF is not dead like some bloggers are reporting. Due to its web and cross-platform capabilities it is doubtful SL will ever truly contain 100% of the functionality of its bigger brother WPF. WPF includes some very Windows-specific functionality.

Found the document mentioned above. Here it is...

Scott
Does that mean that if you code using only a subset of WPF that it can be made into a silverlight app, or are there other differences?
Giovanni Galbo
My understanding is Yes although I have never tried to code a WPF app and then just turn it into a SL app. A SL assembly is the same as a WPF assembly except there is some version checking going on. That makes the assemblies incompatible (runtimes are different versions). If you know which functionality to stay away from in WPF you should be able to just copy and paste the XAML, compile and it works.
Scott
Giovanni Galbo: Writing a WPF app and then trying to port it to Silverlight usually requires a lot of effort due to differences in the two platforms. However going in the opposite direction, starting with a Silverlight app and porting it to WPF should be reasonably straight-forward.
KeithMahoney
Watch out for that. Some feature in Silverlight are not found in WPF. Some of them because they are 'broswer-base' things, but as Silverlight is developped more than WPf thses days, some feature may be left out in WPF.
David Brunelle
A: 

One and two.

FFire
Should really be a comment rather than an answer
ChrisF
@ChrisF No, it Should be an answer.
FFire
@FFire - potential (in this case actual) duplicate answers should be posted as comments rather than an answer.
ChrisF