I wanted to follow up on a previous post about learning Silverlight. As I’ve been creating (and refactoring) an application at work, I’ve used the MVVM (Model-View-ViewModel) design pattern to separate the UX (User Experience) from the data and logic of the application.
- Model – This is a “dumb” class that is just a wrapper for data properties
- View – The entire UX is contained in these classes. There is NO CODE in any of these classes, and they can be modified using design tools rather than a traditional IDE (Visual Studio).
- ViewModel – This is glue that creates Model classes (using the Service classes) and pushes that data to the View classes. I’m using a ViewModel base class to implement the INotifyPropertyChanged interface. This is the magic that monitors the data and updates the UI as data changes.
- Service – This isn’t explicitly defined in the pattern, but I am using the Service classes to interact with external systems (web services, Local Storage). In addition, classes that would normally exist as a web service are deployed as local service classes (since this application is deployed as a standalone xap, with no server dependencies).
MVVM Learning Resources