Convert WPF Application to SilverLight Convert WPF Application to SilverLight wpf wpf

Convert WPF Application to SilverLight


I would argue that you CAN port Silverlight to WPF with minimal effort. I spent 2 hours porting and application I spent 3 weeks writing. I would argue that those 2 hours spent would categorize as minimal effort.

Sure, you need to create a new project, add the files to the new project and tweak them.

Since Silverlight is a subset of WPF its allot easier to go from Silverlight to WPF than the other way around.

For business logic and non-UI code your code should port almost straight across. I had some minor issues around authentication, as Silverlight 2 will pick up any authentication information in the browser, while in WPF you have to role your own login screen and manage cookies etc.

For the XAML it will port straight across if you don't style your controls. If you style your controls the use of the Visual State Manager, currently missing in WPF, will make things a little trickier. You can either re-style your controls in WPF using Triggers, or you can use the VSM implementation for WPF done by John Gossman. Microsoft have announced that they will add the VSM to WPF to make the two frameworks more compatible.

The perhaps most important reuse tough, is skills and experience. Since the two platforms are so similar you will be able to reuse all your skills in WPF.

I recently did a blog post about the Dive Log sample application and how I ported it from Silverlight 2 to WPF. Might give you some idea of the process.


Not really. I have found some articles regarding the multi-targeting option for WPF and Silverlight at the same time. At this moment, if you are not using PRISM, it is quite a challenge to target both of them, fortunately achievable.

What do you need to have in mind is that Silverlight uses a smaller (thus more limited) library than WPF.

In response to the comments:Actually, there is already support for silverlight in PRISM (v2). The idea of PRISM is to provide guidance to developing applications not only using WPF but using Silverlight also - Prism V2 formally was known as Composite Application Guidance for WPF and Silverlight.By using PRISM for silverlight capabilities, it would give you the warranty that your code would work on both platforms with minimal changes, if none (except maybe the different project types for visual studio).

But of course, if you already started developing your application, you would need to change your code to use PRISM.


Will and Bogdan's answers are correct. The keyword here is "minimal".Rob Eisenberg has a list of differences here (though this was pre-RTW).

List of Differences in WPF & Silverlight