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