views:

1208

answers:

6

I have to build small (for now) admin app in Silverlight2, and would like to use some pattern for binding UI with my BL/DAL.
I found view-model-viewmodel and mvp/mvc patterns, where first one (V/M/VM) is specially suited for WPF apps, because it uses rich capabilities of WPF data-binding options. What do you suggest? Can you write simple example of V/M/VM for SL2?

+4  A: 

Nikhil Kothari has a great set of examples (with code) on M-V-VM in Silverlight as well as a framework built with some very nice extra features. You should definitely check them out. M-V-VM in Silverlight

Jedidja
A: 

Norwegian developer Gjøran had a very nice presentation/demo at MSDN Live about writing business apps in WPF. Really it was about using Presentation Model with Silverlight/WPF. Have a look at the source code from this article on his blog (sorry, the slides are in Norwegian only). Presentation Model + silverlight 2 rocks!!!

Torbjørn
+1  A: 

The Patterns & Practices group at Microsoft has put together some guidance around doing WPF and Silverlight applications.

Aaron Weiker
+1  A: 

You might want to look at CSLA.NET for Silverlight. I've heard good things about it but haven't gotten around to try it yet myself.

CSLA .NET for Silverlight is a subset of CSLA .NET targeted at the Silverlight platform. CSLA .NET for Silverlight offers nearly all the benefits of CSLA .NET on Silverlight, including data binding, validation, business rules, authorization, n-level undo and persistence.

The result is that CSLA .NET for Silverlight enables the creation of a rich object-oriented business layer running on the Silverlight client, that can transparently communicate with CSLA .NET objects running on the web and application servers.

Craig Nicholson
+1  A: 

Silverlight has also very powerful data-binding, so there is no problem with that.

The missing piece in Silverlight that affects more to the Model-View-ViewModel pattern is that it doesn’t implements commands like WPF. Here is an article by Josh Smith that reproduces the command pattern of WPF in Silverlight.

DaniCE
+1  A: 

Shawn Wildermuth of Wildermuth.com wrote an article about the MV-VM Pattern, check it out, here is the link of the article "Model-View-ViewModel In Silverlight 2 Apps"