2

I've been spending quite alot of time recently trying to learn XAML/C#/WPF/Silverlight, trying to build a Desktop application as well as a web application to go along with it, re-using the same code if possible.

Prism seems like the optimal tool to do this, allowing me to keep both MVVM, Silverlight and DesktopWPF in mind all at once. However, my concern derives from two places:

1) Almost all of the videos/examples I have been reading (wrt PRISM) are Prism v2, save for the 342 page Prism v4 documentation I am going through right now. Also it seems like documentation/updates in the whole Prism world are very sparse, PRISM v4 was last updated over a year ago. This causes problems when I watch a video showing me how to do something in Prism v2, then I learn that Silverlight v4 has actually brought some breakthrough that means I can do the same thing in a much more logical manner. Is there any updated tutorials, at least ones the outline the changes w.r.t. Prism (eg ICommand support, few changes to Region). I'm learning this for the first time and I'd rather learn v4 than v2 and know all of the updated practices.

2) The PROJECT LINKER VS2010 extension (which seems 100% neccessary in order to do a multi-target WPF & Silverlight deployment re-using the same code base, has only been downloaded 5000 times?! Does this mean there are at most 5000 companies even TRYING to deploy apps to both WPF and Silverlight at the same time? Why is that? It seems (to me at least) that being able to write 1 code base that deploys to both Desktops and web-based platforms is a HUGE advantage, but it worries me if I am one of only 5000 people doing a dual WPF/Silverlight development that perhaps there is another better solution?

Basically, is there any resource for updated Prism v4 documentation/practices, and is PRISM/Project linker for VS2010 a reliable way to start coding a dual Desktop/Web-based application starting from the ground up?

nik_0_0
  • 23
  • 2
  • Trying to create a silverlight app and a wpf app from the same code is quite hard and very expensive. The project linker helps, but it's only part of the problem. Consider this: how do you write common XAML that uses a GridSplitter? It's in different namespaces in WPF and SL. So yes, I do totally believe it's only been downloaded 5K times. – Mike Post Jun 09 '11 at 02:37
  • Perhaps I should have been more clear, but by using MVVM and Prism; not ALL the code is re-used, more specifically the "Views" - being the .xaml of the actual displayed window would be Silverlight/WPF specific (eg. there would exist a GridShell and a GridShell.WPF) .xaml, but they both connect to the same ViewModel .cs code through DataContext and therefore offer the same information. Therefore the GridSplitter in WPF.xaml and SL.xaml could be in different namespaces with no problem (if I'm not mistaken). – nik_0_0 Jun 09 '11 at 12:48
  • But then what's the point? All of the difficult coding on the client side is bending the XAML to your will. You need a REALLY compelling business reason to write the same app twice and pay for support calls on both platforms. Such reasons are not common. And lest it be said I'm arguing just to argue, I wish I had an answer for #1, but I don't. – Mike Post Jun 10 '11 at 00:25

1 Answers1

0

We have created a number of large PRISM projects (V2 and V4) for WPF and Silverlight with lots of shared code and have run into the same issues you have.

With regard to item 1: we just read up everything and try to bear the date of the docs in mind. PRISM always makes us feel like we are trail blazing, so you are not alone in that respect.

With regard to item 2: On the basis that simplest is often best (and our raw C# code is just raw C# code, regardless of platform), we keep separate libraries for our WPF and Silverlight projects and WinForms etc, but if the code needs to be shared we keep the original in a common .Net library (just for storage) and use the "link" option for including files in other projects.

(forgive the following as overkill, I am playing with SnagIt:)).

Add existing item... enter image description here

Add as a linked file...

enter image description here

The file remains in the original place and the file icon has a little link symbol in the project...enter image description here

We also find ourselves back here at Stack Overflow quite a lot for these sort of issues, so at least you are in good company.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202