Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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

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.

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.

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"

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!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top