Basically, a ViewModel is a wrapper around a model. Now this may not be very useful :-) Think of the model as the data that your application works with, say, a person. Now the person has a birthday, and you may want to get a form to enter the person’s birthday. Suppose we just use a simple TextBox, the date shows something like 02/01/2009 12:00:00 AM. For starters, we don’t need part of the time, and we also cannot be happy with part 02-02-2009, since it depends on your locale settings.
So, here the ViewModel comes im. It completes the Person class and displays the date as three integer values, year, month, and day. In a set of properties, he tries to build a date from different values and displays any errors that may occur.
So he simply said that ViewModel is a model shell specially designed for a certain type (display). It eliminates most IValueConvertors at the same time.
Josh Smith has a nice explanation here: http://joshsmithonwpf.wordpress.com/2008/11/14/using-a-viewmodel-to-provide-meaningful-validation-error-messages and a great discussion here: http: // groups.google.com/group/wpf-disciples/browse_thread/thread/3fe270cd107f184f?pli=1
Maurice Jan 6 '09 at 13:41 2009-01-06 13:41
source share