WPF MVVM Training Michael Sync (Silverlight MVP)

  • Published on

  • View

  • Download

Embed Size (px)


<ul><li> Slide 1 </li> <li> WPF MVVM Training Michael Sync (Silverlight MVP) </li> <li> Slide 2 </li> <li> 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 </li> <li> Slide 3 </li> <li> What's MVVM? is an architectural pattern created by John Gossman from WPF team is a variation of MVC pattern is similar to Martin Fowlers PresentationModel pattern WPF Data Binding &amp; Commanding </li> <li> Slide 4 </li> <li> Motivation and benefits Testabiltiy ( ViewModel is easier to unit test than code- behind or event driven code ) Clear seperation between 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 </li> <li> Slide 5 </li> <li> MVVM View knows ViewModel ViewModel knows Models But not vice versa. </li> <li> Slide 6 </li> <li> 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. </li> <li> Slide 7 </li> <li> 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 </li> <li> Slide 8 </li> <li> 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 </li> <li> Slide 9 </li> <li> Disadvantages of MVVM lack of standardization so everyone has own favor For simple UI, M-V-VM can be overkill </li> <li> Slide 10 </li> <li> Implementing MVVM DEMO Simple MVVM DEMO MVVM + Data Template DEMO DI + IoC DEMO BDD </li> <li> Slide 11 </li> <li> Supporting libraries and frameworks WPF Team : MVVM ToolkitMVVM Toolkit MS Pattern and Practice Team : Composite WPF (Prism)Composite WPF (Prism) Josh Smith. "MVVM Foundation"MVVM Foundation Sacha Barber. "Cinch."Cinch Karl Shifflett. "Ocean"Ocean Laurent Bugnion. "MVVM Light Toolkit"MVVM Light Toolkit Lester Lobo. "CoreMVVM"CoreMVVM Rob Eisenberg. "Caliburn"Caliburn William e Kempf. "Onyx"Onyx Peter OHanlon. "GoldLight"GoldLight jbe. "WPF Application Framework (WAF)"WPF Application Framework (WAF) Paul Stovel : MacroModelsMacroModels </li> </ul>