Introduction to MVVM<br />           In  Silverlight<br />Honeyson Joseph D<br />                                         ...
What is MVVM ??<br /><ul><li> MVVM is nothing but a Pattern.
 Also known as Presentational Model.
 Model-View-ViewModelpattern is similar to MVC</li></ul>2<br />http:/facebook/honeydev<br />
Let’s see some variations of similar patterns<br />MVC Pattern<br /><ul><li>Model View Controller is probably the oldest p...
 Still using widely, especially with ASP.NET MVC.</li></ul>3<br />http:/facebook/honeydev<br />
Passive View Pattern<br /><ul><li>View is completely Passive.
 The controller has lot of responsibilities.
 Testing a View is very difficult and time consuming.</li></ul>4<br />http:/facebook/honeydev<br />
Presentation Model Pattern(MVVM)<br /><ul><li> Controlleris replaced with ViewModel.
 Viewis more active and pushing information to the Model.
 The interactions is done via Data Binding.</li></ul>5<br />http:/facebook/honeydev<br />
6<br />http:/facebook/honeydev<br />
Model<br />Model represents the business domain which includes the<br />model classes used (Customer, Order, etc.), data a...
View<br />  Viewin MVVM represents the screens that we build.<br />Includes :<br />                  1.XAML files<br />   ...
Upcoming SlideShare
Loading in …5
×

Introduction to MVVM Framework

3,447 views

Published on

It's just an introduction to MVVM framework

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,447
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
101
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to MVVM Framework

  1. 1. Introduction to MVVM<br /> In Silverlight<br />Honeyson Joseph D<br /> http:/facebook.com/honeydev<br />1<br />http:/facebook/honeydev<br />
  2. 2. What is MVVM ??<br /><ul><li> MVVM is nothing but a Pattern.
  3. 3. Also known as Presentational Model.
  4. 4. Model-View-ViewModelpattern is similar to MVC</li></ul>2<br />http:/facebook/honeydev<br />
  5. 5. Let’s see some variations of similar patterns<br />MVC Pattern<br /><ul><li>Model View Controller is probably the oldest pattern.
  6. 6. Still using widely, especially with ASP.NET MVC.</li></ul>3<br />http:/facebook/honeydev<br />
  7. 7. Passive View Pattern<br /><ul><li>View is completely Passive.
  8. 8. The controller has lot of responsibilities.
  9. 9. Testing a View is very difficult and time consuming.</li></ul>4<br />http:/facebook/honeydev<br />
  10. 10. Presentation Model Pattern(MVVM)<br /><ul><li> Controlleris replaced with ViewModel.
  11. 11. Viewis more active and pushing information to the Model.
  12. 12. The interactions is done via Data Binding.</li></ul>5<br />http:/facebook/honeydev<br />
  13. 13. 6<br />http:/facebook/honeydev<br />
  14. 14. Model<br />Model represents the business domain which includes the<br />model classes used (Customer, Order, etc.), data access<br />code and business rules.<br />7<br />http:/facebook/honeydev<br />
  15. 15. View<br /> Viewin MVVM represents the screens that we build.<br />Includes :<br /> 1.XAML files<br /> 2.code-beside files<br /> Responsibilities : <br /> 1.displaying data <br /> 2.collecting data from end users <br /> View isn't responsible for retrieving data, performing any <br /> business rules or validating data<br />8<br />http:/facebook/honeydev<br />
  16. 16. ViewModel<br />ViewModel acts as middle-man between View and Model<br />Responsibilities : <br /> Aggregating and storing data that will be bound to a View<br />9<br />http:/facebook/honeydev<br />
  17. 17. Helpers around MVVM…<br /><ul><li>Commands
  18. 18. Messages</li></ul>10<br />http:/facebook/honeydev<br />
  19. 19. Helpers around MVVM…cont<br />View might need to notify the ViewModelabout something happened in the View.<br /> eg: a control being clicked.<br />ViewModelneed to notify to the View when something happen. <br />For these we use Events, another good way is to use Messages.<br />11<br />http:/facebook/honeydev<br />
  20. 20. MVVM in Silverlight<br /><ul><li> We use MVVM Light Tools V.x
  21. 21. This is an open source MVVM very light Framework with 2 </li></ul> DLLs<br />Components<br /><ul><li>RelayCommand
  22. 22. Messenger
  23. 23. ViewModelBase. </li></ul>Also<br />1. EventToCommandwhich can be used to get rid of annoying<br />WPF and SL Command binding limitations.<br />2. DispatcherHelperfor multi-threaded applications.<br />12<br />http:/facebook/honeydev<br />
  24. 24. For Example<br /> Step 1<br />VIEW<br />Button Base.Command connects view with ViewModel (GetPersonreturntype is Icommand—comand object)- following Commn design pattern<br />VIEW Model<br />PersonViewModelcontructor connects to PersonModel<br />13<br />http:/facebook/honeydev<br />
  25. 25. Model<br />Property changed event results in UI updates – from context (two way binding)<br />14<br />http:/facebook/honeydev<br />
  26. 26. References:<br />http://weblogs.asp.net/dwahlin/archive/2009/12/08/getting-started-with-the-mvvm-pattern-in-silverlight-applications.aspx<br />http://www.silverlight.net/learn/tutorials/silverlight-4/using-the-mvvm-pattern-in-silverlight-applications/<br />http://www.astaticstate.com/2010/04/silverlight-4-using-mvvm-patter-ria.html<br />Go on more, share your knowledge that help to others including me……………THANK YOU !<br />15<br />http:/facebook/honeydev<br />

×