XamlFest: View-Model-ViewModel Pattern

Some quick notes about one architectural pattern for WPF apps -- this is a modified version of MVC/MVP.

The Model

  • bottom layer of the pattern
  • no knowledge of the View (UI)
  • variables should be named in UI-agnostic terms ("available" vs "visible")
  • .NET class

The View

  • WPF/Silverlight representation of the UI
  • should have minimal code
  • connects to the ViewModel through the DataContext property
  • should be editable in either Blend or Visual Studio
  • XAML file

The ViewModel

  • represents the "glue" between the UI and the back end
  • presents data and interacts with code
  • responsible for property change notifications
  • exposes RoutedCommand and DelegateCommand commands
  • shouldn't contain references to specific UI elements
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted @ Tuesday, November 25, 2008 11:48 AM

Comments on this entry:

Gravatar # re: XamlFest: View-Model-ViewModel Pattern
by Kathleen at 11/25/2008 8:39 PM

With this approach, where do you put the validation and authorization logic?
Gravatar # re: XamlFest: View-Model-ViewModel Pattern
by validation at 11/26/2008 6:39 PM

Kathleen and Jeff: take a look at this post by Josh Smith (WPF MVP)
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: