Wpf mvvm training
Download
1 / 11

WPF MVVM Training - PowerPoint PPT Presentation


  • 105 Views
  • Uploaded on

WPF MVVM Training. Michael Sync (Silverlight MVP). Adopting the MVVM pattern with WPF. Understanding MVVM Motivation and benefits Implementing the pattern Dependency Injection and IoC Unit Test and Mock Supporting libraries and frameworks. What's MVVM?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' WPF MVVM Training' - lucas-bonner


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Wpf mvvm training

WPF MVVM Training

Michael Sync (Silverlight MVP)


Adopting the mvvm pattern with wpf
Adopting the MVVM pattern with WPF

  • Understanding MVVM

  • Motivation and benefits

  • Implementing the pattern

  • Dependency Injection and IoC

  • Unit Test and Mock

  • Supporting libraries and frameworks


What s mvvm
What's MVVM?

  • is an architectural pattern created by John Gossman from WPF team

  • is a variation of MVC pattern

  • is similar to Martin Fowler’s PresentationModel pattern

  • WPF Data Binding & Commanding


Motivation and benefits
Motivation and benefits

  • Testabiltiy ( ViewModelis easier to unit test than code-behind or event driven code)

  • Clearseperationbetween UX designer and developer

  • Increases the "Blendability" of your view

  • Model never needs to be changed to support changes to the view

  • ViewModel rarely needs to be changed to support changes to the view

  • No duplicated code to update views


MVVM

  • View knows ViewModel

  • ViewModelknows Models

  • But not vice versa.

View

ViewModel

Model


View

  • represents the user interface that the user will see.

  • can be a user control or Data Template

  • shouldn't contain any logic that you want to test

  • Keep the view as simple as possible.


View model
View Model

  • An abstraction of View

  • Connector between View and Model

  • Keep View State, Value Conversion

  • No strong or weak (via Interface) reference of View

  • Make VM as testable as possible (e.g. no call to Singleton class)

  • No Control related Stuff in VM


Model
Model

  • can be Data Model, DTO, POCO, auto-generated proxy of domain class and UI Model based on how you want to have the separation between Domain Service and Presentation Layer

  • No reference to ViewModel


Disadvantages of mvvm
Disadvantages of MVVM

  • lack of standardization so everyone has own favor

  • For simple UI, M-V-VM can be overkill


Implementing mvvm
Implementing MVVM

  • DEMO – Simple MVVM

  • DEMO – MVVM + Data Template

  • DEMO – DI + IoC

  • DEMO – BDD


Supporting libraries and frameworks
Supporting libraries and frameworks

  • WPF Team : MVVM Toolkit

  • MS Pattern and Practice Team : Composite WPF (Prism)

  • Josh Smith. "MVVM Foundation"

  • Sacha Barber. "Cinch."

  • Karl Shifflett. "Ocean"

  • Laurent Bugnion. "MVVM Light Toolkit"

  • Lester Lobo. "CoreMVVM"

  • Rob Eisenberg. "Caliburn"

  • William e Kempf. "Onyx"

  • Peter O’Hanlon. "GoldLight"

  • jbe. "WPF Application Framework (WAF)"

  • Paul Stovel : MacroModels


ad