Simple MVVM Walkthrough – Part I

The Agile Warrior

Not being able to find a simple MVVM walkthrough I really liked, I created this simple example for those just wanting to see quickly how to connect the dots.

It doesn’t do anything fancy (just uses some basic databindings and a single command) but if you are just looking for a quick example of how to hook the View to the ViewModel hopefully this will help.

The app

This example is based on a simple WPF application. You basically enter some data and it populates a label.

How it all works

MVVM (a variant of MVC and MVP) uses WPF databinding to keep UI controls and Model elements in sync.

This clear separation of concerns makes applications more testable, and well as eliminating a lot of the event plumbing you would otherwise need to keep all your controls up-to-date.

Here’s a short walk through of what’s going on.

The…

View original post 949 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s