Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Dual Targeting WPF and Silverlight (and Windows Phone 7)

Pete Brown - 26 August 2010

Prior to working at Microsoft, I had some customers who wanted to dual target both WPF and Silverlight. Since then, Windows Phone 7 has been added into the mix. With all these similar technologies, all using xaml, multi-targeting applications can be a reality. It's not without its challenges, however.

At DevLink 2010, I presented my "Dual Targeting" talk. I've presented this talk at a few conferences. With the addition of WP7, maybe I need to change it to "multi-targeting" as xaml hits more platforms :)

image

I discuss which things are easiest to share, and which are hardest. I also recommend some approaches on how to structure your project, as well as a comparison of the different ways by which you can share code and xaml. I cover assembly portability, code sharing using linked files, usercontrol encapsulation and abstraction, and even loading xaml at runtime after futzing with the source via code.

image

Zip file with slides and VS2010 source code attached. The source doesn't have all the examples, but does include the main scenarios. You'll need VS2010, .NET 4 and Silverlight 4 to open the solution.

(NOTE: You'll need to add a reference to system.xaml in the ReuseLibWpf project to fix the compile error. My bad)

             

Source Code and Related Media

Download /media/66110/petebrown_multitargeting_wpf_silverlight.zip
posted by Pete Brown on Thursday, August 26, 2010
filed under:              

Comment on this Post

Remember me