0

Is it possible to use the same Views for Silverlight and WPF? I have ported a little MVVM Silverlight project to WPF. I could reuse all instead of App/MainWindow and the Views.

How could I reuse the Views?

koalabruder
  • 2,794
  • 9
  • 33
  • 40

2 Answers2

1

They're built on a different stack - Silverlight uses a subset of XAML and different version of the CLR. With that being said, a lot of your views' XAML can be reused, maybe all of it. You probably can't reuse your views as they are.

Big Daddy
  • 5,160
  • 5
  • 46
  • 76
  • Thanks. If I use "the" subset of XAML is there sth. like a batch script to convert the views? Could I use sth. Like Templates? – koalabruder Aug 24 '12 at 15:35
  • 1
    I don't know of any such tool to convert the views. The xaml is very similar. There are no X:Static or X:Type markup extension in Silverlight, so if you have these, they need to be changed. The binding is nearly the same, but the commanding is different. – Big Daddy Aug 24 '12 at 15:52
0

You can reuse the views provided that your xaml contains only the basics of Silverlight. In other words, do not use the toolkit controls unless they are also supported in the WPF toolkit. Do not use the expression interactions in the Silverlight xaml as they are not in WPF. Silverlight is a "subset" of WPF in a not really sort of way. All basic controls in Silverlight (eg: Button, ListBox, Grid) have the same namespaces and their WPF counterparts. Most (maybe all) even have the same properties. It is possible to do this, but you need to be careful and design for Silverlight first.

Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41