When I started the MVVMKit project I had few goals in mind based on observations of real life applications. While each application deals with a specific domain model they seem to use certain constructions or patterns.

One of these patterns is field key(s) and data value(s) attached to it. In MVVMKit I call this construction a DataContext and its main goal is to link one or more fields with a data value. We’ll see that this value can be a simple data type or complex data type depending on application.

Another pattern that I noticed is the need to detect changes in a DataContext between an initial value and a current value. This needs to work with any type of values in DataContext so to make things easier I wrote a number of utilities that compare .net classes and .net collection. These utilities are located in the MagnaImagina.Utilities library.

Transactional support in DataContextis is another patter often seen in many applications. This means that we should be able to programmatically commit or rollback changes in DataContext, more like a Save or Cancel in a dialog box. This often times is implemented by each application and I felt that providing this feature in DataContext will greatly reduce the coding needs. Again, this should work on any data type and collections.

Handling data validation is another must have in most business applications. Now, WPF has a lot of built in support for this requirements but a well architected application (mostly enterprise level apps) have all the validation built in a rules engine. This means that the DataContext must be able to “receive” validation messages/errors from an outside entity and then WPF will take care of displaying them to the users.

Another important aspect of any MVVM application is communication between view models. For this I created a very simple MessageAggregator much like the one in Prism and other frameworks. The implementation is very simple but works for most scenarios.

Lastly, dealing with commands is another core aspect of MVVM. MVVMKit contains few options for creating ICommand implementations using either the RelayCommand or deriving new classes from CommandBase class. Also transforming certain UI events into commands is a very useful and for that I created EventToCommand.

More details and code examples will be included in the full documentation document coming soon.

Last edited Dec 15, 2010 at 12:09 AM by magnaimagina, version 1


No comments yet.