PDC09 – Day Two – Advanced Topics for Building Large-Scale Applications with Microsoft Silverlight

MVVM – Model-View-ViewModel

  • Separation of concerns
  • View = handled UI
  • Model = contains pure data
  • ViewModel = communicates between View and Model through bindings
  • Works Great with Silverlight and WPF
    • XAML based data bindings
  • Testable


  • Model
    • Represents the Data
    • The entity
    • Not required to know where it gets the data from
      • WCF service, WCF Ria Services
  • View
    • The Screen, the UI
  • ViewModel
    • Main source of logic for the MVVM triad
    • Connects the Model and the View
    • Abstracts the View
    • Public Properties that are bound to the View
    • INotifyPropertyChanged and INotifyCollectionChanged talk to the view through bindings
    • Listens for changes from the View made to the Model
  • Variations of the MVVM
    • View First
      • ViewModel is declared as StaticResource in the Views XAML
        • Works well in Blend
      • Another way is to create the ViewModel in the View’s code-behind
    • ViewModel First
      • View is injected into the ViewModel’s constructor
      • Doesn’t allow the possibility to use Blend
    • View and ViewModel Marriage
      • View must be paired with the ViewModel somehow
      • Doesn’t allow the possibility to use Blend
  • What don’t we have with MVVM
    • Commanding

Prism 2

  • Prism is a set of options
  • Use what you want and ignore the rest
  • Technical Concepts:
    • Modules
    • Shell
    • Commands
    • Containers
    • Regions
    • Bootstrapper
    • Event Aggregation
    • Unity and Dependency Injection

Leave a Reply

Your email address will not be published. Required fields are marked *