WPF: MVVM, ViewModel, Model & MessageBoxes

Deutsche Version

I’ve never been much of a GUI developer and my programs look it.

Where I’m good at is the Businesslogic part of the application.

That’s why I’ve always stuck to known territory, where you can align controls along lines and it looked halfway decent (though not pretty).

But times they are a-Changin’ and now I’ve challenged myself o the topic of WPF (Windows Presentation Foundation) in tandem with MVVM (Model-View-ViewModel).

As a starting point I took a program I wanted to write anyway and as such it was ideal as a training ground.

In the ZIP file linked below you’ll find the result. It contains a classic Windows Forms program which is designed as MVVM as well as its WPF counterpart.

Both programs use the same model but have tailored ViewModels.

All accesses from the Model to either the UI (i.e. File Dialogs or MessageBoxes) or the file system are completely encapsulated and are provided by the clients of the Model.

Thus the program should be completely testable by Unit tests since all interfaces are mockable.

I believe the resulting code is quite clear and should be understandable by a developer who wants to delve into the topic of MVVM.


The sequel: WPF: MVVM & Responsive UI