SlideShare a Scribd company logo
MVVM In Use



Chris Charabaruk
The Model-View-ViewModel
Pattern
Model     View      ViewModel
Business logic & data
Connect application
to actual data store
“Brain” of app
The Model-View-ViewModel
Pattern
Model    View     ViewModel
User interface only
Gets/sends data via
bindings with
ViewModel
Sends commands
from user to
ViewModel
Eyes & hands of app
The Model-View-ViewModel
Pattern
Model   View     ViewModel
Application logic
Connects Model and
View
“Spine” of app
Bindings and commands
Bindings transfer data between View and
ViewModel
Bindings declared in View
Bindings implemented in framework
Commands are messages to ViewModel
from View
Commands connected through bindings
Commands declared in ViewModel
Commands implemented in ViewModel
Demo: MVVM Basics




      Run Demo
Demo: MVVM Basics
Demo: MVVM Commands
Demo: MVVM Commands
Resources
MVVM In Use support site
  http://mvvmspeech.tumblr.com
MVVM In Use sample app
  http://github.com/coldacid/mvvm-sample

More Related Content

PPTX
The MVVM Pattern
ODP
Design Patterns in ZK: Java MVVM as Model-View-Binder
PPTX
MVVM ( Model View ViewModel )
PPTX
Slide Presentation of MVP Pattern Concept
PDF
Introduction to Angularjs : kishan kumar
PPTX
MVVM with WPF
 
PPTX
Design Pattern - MVC, MVP and MVVM
PPTX
Model View Presenter (MVP) In Aspnet
The MVVM Pattern
Design Patterns in ZK: Java MVVM as Model-View-Binder
MVVM ( Model View ViewModel )
Slide Presentation of MVP Pattern Concept
Introduction to Angularjs : kishan kumar
MVVM with WPF
 
Design Pattern - MVC, MVP and MVVM
Model View Presenter (MVP) In Aspnet

What's hot (20)

PDF
當ZK遇見Front-End
PDF
Introduction to Angular Js
PDF
MVVM in iOS presentation
ODP
What is MVC?
PPTX
MVx patterns in iOS (MVC, MVP, MVVM)
PDF
Angular JS Introduction
PPTX
AngularJs (1.x) Presentation
PPTX
Model viewviewmodel2
PPT
Asp.net mvc
PPT
Angular Seminar-js
PPT
Why MVC?
PPTX
Angular js presentation at Datacom
PPT
CTTDNUG ASP.NET MVC
PPTX
Mvc fundamental
PPTX
Introduction to AngularJS Framework
PDF
AngularJS: Overview & Key Features
PPTX
Introduction to mvc architecture
PDF
MVC Seminar Presantation
PDF
MVC architecture
當ZK遇見Front-End
Introduction to Angular Js
MVVM in iOS presentation
What is MVC?
MVx patterns in iOS (MVC, MVP, MVVM)
Angular JS Introduction
AngularJs (1.x) Presentation
Model viewviewmodel2
Asp.net mvc
Angular Seminar-js
Why MVC?
Angular js presentation at Datacom
CTTDNUG ASP.NET MVC
Mvc fundamental
Introduction to AngularJS Framework
AngularJS: Overview & Key Features
Introduction to mvc architecture
MVC Seminar Presantation
MVC architecture
Ad

Similar to MVVM In Use (20)

PDF
Portable Class Libraries and MVVM
PPTX
Mvvw patterns
PPT
Ppt of Basic MVC Structure
PPTX
Stephen Kennedy Silverlight 3 Deep Dive
PPTX
Ios models
PPTX
MVC & backbone.js
ODP
Mvc
PPTX
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
PDF
Principles of MVC for PHP Developers
PPTX
Model view controller (mvc)
PPTX
MVVM presentation
PDF
Top 40 MVC Interview Questions and Answers | Edureka
PDF
MVC in PHP
PPTX
Intro ASP MVC
PPT
MVC(Model View Controller),Web,Enterprise,Mobile
PPTX
Architectural Design Pattern: Android
DOCX
IntroductionToMVC
PPTX
Introduction of ASP.NET MVC and AngularJS
PPT
Model View ViewModel
PDF
Lecture 05 - Creating a website with Razor Pages.pdf
Portable Class Libraries and MVVM
Mvvw patterns
Ppt of Basic MVC Structure
Stephen Kennedy Silverlight 3 Deep Dive
Ios models
MVC & backbone.js
Mvc
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Principles of MVC for PHP Developers
Model view controller (mvc)
MVVM presentation
Top 40 MVC Interview Questions and Answers | Edureka
MVC in PHP
Intro ASP MVC
MVC(Model View Controller),Web,Enterprise,Mobile
Architectural Design Pattern: Android
IntroductionToMVC
Introduction of ASP.NET MVC and AngularJS
Model View ViewModel
Lecture 05 - Creating a website with Razor Pages.pdf
Ad

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Machine Learning_overview_presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
1. Introduction to Computer Programming.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
Machine Learning_overview_presentation.pptx
Electronic commerce courselecture one. Pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
MIND Revenue Release Quarter 2 2025 Press Release
gpt5_lecture_notes_comprehensive_20250812015547.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
1. Introduction to Computer Programming.pptx
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectroscopy.pptx food analysis technology
A comparative analysis of optical character recognition models for extracting...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation

MVVM In Use

Editor's Notes

  • #2: Were you confused by my presentation last month on MVVM? A common issue with the presentation was a lack of an example showing you how the pattern works to make better apps.Today I will be expanding on last month’s presentation, The MVVM Pattern, by demonstrating how the Model-View-ViewModel pattern works. We’ll cover the basics of the pattern again, followed by the presentation of a demo application. Finally, I’ll open the floor to questions.
  • #3: First, the Model.This part of the pattern can be shared between apps, and is usually just how the application retrieves and stores the data it operates on.It is the “brain” of the application, because it’s your memory, and without it, you’d be dead (there’d be no app).
  • #4: Second, the View.The view is the application’s user interface, and nothing else. Through commands and bindings it interacts with the ViewModel.The View serves as the eyes and hands of the application. It is how the user interacts with the app.
  • #5: Third, the ViewModel.This is where all the action happens in the application. It connects the Model and View, working directly on Model objects while staying arms-length from the View, via bindings and commands.A single ViewModel can work with multiple different Views, but the inverse isn’t usually true.The ViewModel is the nervous system of the application; without it, the brain isn’t connected to the eyes or hands.
  • #6: Finally, bindings and commands.Bindings serve as a way to let the View and ViewModel pass data, without making them directly rely on each other. Bindings are declared in the View, and the application framework uses them to dynamically connect it to the ViewModel.Commands can be thought of as form messages prepared by the ViewModel and given to the View. When the user clicks a button or interacts with the app in a way that isn’t directly manipulating data, the View will send the appropriate message to the ViewModel through the binding system.When the ViewModel receives a command, it acts accordingly, based on whatever parameter is passed to it by the View.
  • #7: Now that we’ve gone over the parts of the MVVM pattern, let’s see it in action.This demo app contains a simple model object holding a line of text. The ViewModel object wraps the model object, and exposes the line of text as a property, which is bound in the View to both a label and a textbox.As you’ll see, changing the text in the textbox also changes the text of the label, demonstrating the binding at work!
  • #8: So, what’s going on behind the scenes?I’m not showing the binding manager in this diagram, but you can see what happens when the textbox is changed.The value in the textbox is bound to the text property of the ViewModel, so when the value changes, the view sets the property to the new textbox value. This in turn causes the ViewModel to set the Model’s property, as well as signal to the binding manager (and therefore the View) that the property has changed.When the View is notified of the change, it updates the label, as you saw.
  • #9: We’ll now demonstrate commands.The button in the demo app is bound to a command on the ViewModel. While in this case, it simply pops up a dialog box, commands can also be used to tell the ViewModel to save or update data, move to another part of the application, or any other kind of activity!
  • #10: And here’s how commands work.As the diagram shows, a control in the View sends the Command to the ViewModel.Sometimes commands will cause the ViewModel to operate on the Model object, but in our sample app, that doesn’t happen.After the command is run by the ViewModel, control is returned to the sender of the command. Usually this will be a View, but commands can also be called by other ViewModel objects in more complex applications.
  • #11: In today’s presentation, we’ve reacquainted ourselves with the MVVM architectural pattern, and seen how it works.The MVVM pattern is a great way to make application development and maintenance cleaner and more manageable, by separating different application concerns into their own areas.Later this week, I will be making more information available on the MVVM In Use support site, at mvvmspeech.tumblr.com. The sample app will also be put up for you to play with, and code is already available on the net.If you have any questions, we’ll now take two to three minutes.--- OUT OF TIME: If you still have questions, please visit the support site! You can ask questions about MVVM through there.