MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

At MIX11, I am releasing a new preview of MVVM Light version 4. This new preview contains one small change and one large change.

ObservableObject replaces NotifyPropertyChanged

In the previous preview, I introduced a new class named NotifyPropertyChanged. However, I got a few suggestions to rename this class to ObservableObject, which is indeed a better name. In BL16, NotifyPropertyChanged was deleted and replaced by ObservableObject. Nothing else changes, just the name.

ObservableObject is a very simple implementation of INotifyPropertyChanged suitable for data objects (in the Model, typically) that need to raise the PropertyChanged event, but that are not quite ViewModels. In my MIX11 session, I demo a usage of ObservableObject to build an application using JSON. In WCF, we don’t really need ObservableObject, since all the generated proxies will automatically implement INotifyPropertyChanged.

We have:

Introducing SimpleIoc, a simple IOC container

Last year at MIX10, I did a demo using the Unity IOC container. This helper simplifies the creation and the resolution of services and of the ViewModels, and allows for a cleaner syntax in the ViewModelLocator. Since then, I have tried a multitude of variants for the ViewModelLocator class, and I still came back, over and over again, to the same idea: using an IOC container to do the bulk of the work.

However, I did not want to settle on a given IOC container. There are so many of them, each with specific features, and each with an army of followers Smile so instead… I created my own. Well, to be honest I inspired myself strongly from an existing simple IOC implementation, and I extended it with features that are super useful when working with ViewModels. Also a source of inspiration, the SimpleServiceLocator available on Codeplex.

A more complete article dedicated to the SimpleIoc class in MVVM Light V4 will follow. Also, my MIX11 session “Deep Dive MVVM” features the SimpleIoc in the samples. The session’s recording is available at http://channel9.msdn.com/Events/MIX/MIX11/OPN03.

Cheers,

Laurent

 

Print | posted on Thursday, April 14, 2011 4:16 PM

Feedback

# re: MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

left by Peter Sulek at 4/14/2011 7:59 PM Gravatar
Is there any ETA when you publish more stable version than preview/BL version ?

# re: MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

left by Brian Jimdar at 4/14/2011 8:51 PM Gravatar
This is fantastic Laurent.

I've been hesitating to commit to a big IoC container for small projects, so "IoC-Light" is a great addition in keeping with the "MVVM-Light" theme.

Thanks for your hard work.

# re: MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

left by Michael Brown at 4/18/2011 12:00 AM Gravatar
It is hilarious how much we do in common without prior collaboration. I think you might be my long lost twin

# re: MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

left by Andy at 4/25/2011 9:40 PM Gravatar
Great Mix11 session! I've been figuring out a lot of those problems on my own, but knowing they will be built into the next version of MVVM Light is a happy thought! Thank you for MVVM Light and for Deep Dive at Mix. Keep up the great work

# re: MVVM Light V4 preview 3 (BL16, MIX11 edition!!) #mvvmlight

left by nk54.fr at 4/27/2011 10:17 AM Gravatar
Hi Laurent !
First, i would like to thank you very much for the nice job you've made !

I've a question and a very good one :)
(i know its the wrong place but i don't remeber my account password on codeplex :p)

How can i move from mainpage custom control to another one with the easiest way ? Message ? But if i use message notification, i've seen on several blog that you have to put some code in your codebehind. But it's not what you say in mix : "no code in codebehind" :)

They are dozen tutorial on the net ! But all are made with only one customcontrol ... It's like they post a tutorial to say "hey ! i know mvvm ! i talk about it so i'm in the move !" wtf seriously ^^

And when i find smething it's about wpf or wp7 but never silverlight.

I've tried several thing : use a content presenter bind to a customcontrol property in my mainpage but even if it seems to work on blend : my clientView appear in my contentpresenter. But on start, i got a xamlparseException :(

It would be so nice if you and not a guy who've just try mvvm and never use it in a real project with several customcontrol, give us a simple project with 3 customControl, a button with command etc just to get a real point to start.

It's also hard to find a good implementation of mvvm with wcf services / RIA Services. Cause if all your data com from a web services, you won't need "model" class. It's a headache cause you model folder become empty ^^ : with services, mvvm become a kind of vvm because the model com from the service.

To conclude, i like the lambda expression cause even if magic string are not as bad as we thought, it's more beautifull on my screen ;)

Apologize for my bad english ... -> french ^^

# GenericMessageGenericAction?

left by Jacob at 5/5/2011 4:14 AM Gravatar
Hi Laurent,

Have you thought about adding a GenericMessageGenericAction<TMessage, TCallbackParameter> class into the coming release? Such a class should satisfy the needs of sending user-defined data in a message and also provide a callback with one customizable parameter.

Your NotificationMessageActionGeneric would be a concrete implementation of the GenericMessageGenereicAction class with TMessage set to string.

Cheers,
Jacob
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: