2

Since WPF and Silverlight are very close to each other(in terms of syntax).

My query is , do we have any tool that can convert wpf control to silverlight control and vice versa.

I understand that everything in WPF shall not be expected to run on Silverlight, but since the come from the same code base, is aconversion possible.

Pradeep
  • 484
  • 5
  • 13
  • I'm afraid Microsoft did a good job here to make them LOOKS similar, but in terms of their controls they are quite (if not completely) different. – Bolu Jul 01 '11 at 09:24
  • @Bolu: Silverlight was WPF/E to start with. – Pradeep Jul 01 '11 at 09:31
  • As far as I know, Silverlight and WPF only share the XAML presentation layer.. – Bolu Jul 01 '11 at 10:03
  • @Bolu: I understand your point, but people even talk about the fact that one day silverlight & WPF will merge back again. So it would be like a circle where they started as one, then got divorced and finally remarried. – Pradeep Jul 01 '11 at 10:09

2 Answers2

2

In theory you could write a converter that would work in many cases but it would never work in all cases because the two implementations are not completely compatible. That being the case there would likely be so many issues it could not automatically solve at conversion it would be quicker to just port it manually instead. That is probably why there are no converters available. Not to mention that there is little demand for such a tool.

Phil Wright
  • 22,580
  • 14
  • 83
  • 137
1

WPF controls are built on top of the full .Net.

Silverlight controls are built on top of a subset of .Net.

If the WPF controls were restricted in their use of .Net then it is feasible that a conversion would be possible, but quite frankly I think there would be too many exceptions to make it worthwhile.

Where we need to share code (not controls) between WPF & Silverlight we "link" to files from a common library (the library is only a repository and not built). The Xaml we can cut & paste.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
  • Thanks for the details. Since Silverlight = subset of .Net, Then why is Silverlight conversion to WPF not possible. If possible is there a tool. – Pradeep Jul 01 '11 at 10:03
  • @Pradeep: Possible, but not worth the effort for the gain. Someone would have needed to convert 100s of controls to bother spending the time to make such a tool (and if they owned the control source code, they would simply recompile). Have you considered decompiling the controls and recompiling them with suitably changed library references? – iCollect.it Ltd Jul 01 '11 at 10:54
  • Have to say that if such tool exists, there would be no difference between WPF and Silverlight nowadays. – NestorArturo Jul 01 '11 at 12:23