How to convert a Silverlight application into a WPF application?

    General discussion

  • Hi,

    we've just created a sample Silverlight application with C#, .Net 3.5, VS 2008 (beta2), and ExpressionBlend2 (August Preview) that runs fine in the browser. We now want to make it a standalone application that can run outside of the browser. How can I convert the Silverlight application into a WPF application?

    Thanks for help.


    Wednesday, August 22, 2007 12:26 AM

All replies

  • iam interested in that too if it is doable  :D

    Wednesday, August 22, 2007 8:16 AM
  • hello.

    i'm not really into wpf, but i believe that changing the namespaces used in xaml is a must and maybe the base class used in the code behind file. even though these simple changes will make your code run without problems, i still think that you're wasting wpf power by doing it.

    Wednesday, August 22, 2007 12:29 PM
  • I haven't tried this, but here's what I see, immediately, that would need to change:

    1. Change the output type of the Project to Windows Application. 
    2. Replace the agclr.dll reference with references to PresentationCore.dll and PresentationFramework.dll.
    3. Your main XAML window will inherit from System.Windows.Window, not Panel.
    4. In your Window XAML declaration, you'll need to change 'xmlns=""' to 'xmlns=""'
    5. Another option is to create a new WPF project and copying your code into it.  I can't tell you which would be easier or more efficient.
    6. Of course, some things will be likely be broken, but they should be minimal and easily fixed.

    luisabreu is correct, you're going to be missing out on a LOT of WPF functionality and capabilities, but those can be incrementally added later.

    Wednesday, August 22, 2007 12:50 PM
  • Hi!

    I didn't find a way to change the output type of a Silverlight project to Windows Application using Visual Studio :(


    Thursday, January 22, 2009 11:49 AM
  • If you don't need WPF functionality you can convert the SL app to run outside of the browser using this:



    Thursday, January 22, 2009 11:58 AM
  • If you used controls that are supported in both Silverlight and WPF, it should be straightforward by simply creating a WPF project and placing all the xaml code into the project. The primary things that you would need to change is the namespaces. There may also be some APIs that Silverlight supports that WPF doesn't.

    Thursday, January 22, 2009 12:09 PM