際際滷

際際滷Share a Scribd company logo
M-V-VM

Model View ViewModel for WPF
       (Design Pattern)
Highlights

Created By John Gossman (WPF and Silverlight
Architect at Microsoft)

This pattern is a simple and effective set of Guidelines
for Designing and Implementing a WPF application

Allows you to create a strong separation between
data, behavior and presentation (UI)
Uses

Databinding for 2 way communication between View
                (UI) and ViewModel

  Uses Command pattern (ICommand interface) for
communicating actions or events that happen on View
                       (UI)

  Dependency Properties alongwith Data Binding to
communicate data changes to and from the View (UI)
WPF MVVM Application Layers
What is View, Model and ViewModel?

View                               ViewModel                          Model
? represents the UI that the end   ? is the abstraction of the View   ? Represents the data classes
  user sees                          (UI)                               and contains the data, bound
? can be a user control or Data    ? Communicates data                  to view and modified by view
  Template                           modifications to the Model       ? Hold only the data or
? shouldn¨t contain any logic or     from the View                      information related to an
  code that is to be tested        ? Data changes in Model are          Object;
                                     reflected in the View through    ? It doesn¨t contain the
                                     ViewModel by making use of         behaviors or services that
                                     data Binding and dependency        manipulate this data or
                                     properties                         information, though
                                                                        sometimes it may contain data        View knows
                                                                        validation logic                                                                  Multiple Views : 1
                                                                                                        ViewModel, ViewModel
                                                                      ? Example is ^The Contact                                 1 View : 1 ViewModel   ViewModel (for Wizard
                                                                        information of a person ̄ like    knows Model, but not
                                                                                                                                                        kind of applications)
                                                                        Name, Phone                           vice versa
                                                                        No, Email, Address, Zip Code
                                                                        etc.
Advantages
ViewModel classes are easy to unit test the complete UI without touching the UI code

Testing through ViewModel provides free and fast regression testing which helps to
reduce cost of maintaining application over time

Helps create a smooth Designer/developer workflow

 ? Design team can focus on creating user-friendly views while,
 ? Development team can focus on creating robust ViewModel classes
 ? Which can then be integrated to ensure proper data bindings exist in the View¨s XAML file

Takes full advantage of WPF¨s Data Templates and Commands

Gives more flexibility to change UI without having to refactor the logic or change other
code base
What do u need to Understand in
 Order to Learn and Implement MVVM
Data Binding in WPF
  ? http://msdn.microsoft.com/magazine/cc700358

Command Pattern Implementation in WPF
  ? ICommand Interface usage
       public interface Icommand
       {
         bool CanExecute(object param);
         void Execute(object param);
         event EventHandler CanExecuteChanged;
       }

  ? RelayCommand pattern
  ? Routed Events and Commands in WPF
    ? http://msdn.microsoft.com/magazine/cc785480

Composite Application Library from Microsoft
  ? http://msdn.microsoft.com/library/cc707890

For Unit Testing:
  ? Nunit
  ? Moq Framework for .Net (Third Party classes for testing .Net Apps)
References and Resources
WPF Model-View-ViewModel Toolkit

?http://wpf.codeplex.com/wikipage?title=WPF%20Model-View-ViewModel%20Toolkit

MVVM Foundation on codeplex (A set of classes that helps build WPF Apps based on MVVM)

?http://mvvmfoundation.codeplex.com/

Super Simple MVVM Explained video:

?http://www.charlieblog.net/SuperSimpleMVVM/Large/SuperSimple_MVVM_large/SuperSimple_MVVM_large.html

MVVM MSDN Article:

?http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

MVVM Channel9 video with Karl Shifflett

?http://channel9.msdn.com/shows/Continuum/MVVM/

WPF MVVM Video by Jason Dolinger

?http://hugeonion.com/2009/03/08/wpf-mvvm-video-by-jason-dolinger/

MVVM Explained

?http://csharperimage.jeremylikness.com/2010/04/model-view-viewmodel-mvvm-explained.html
Last Note on MVVM
? It is said that if you have not given names for
  your UI Elements and still able to run and
  process the application properly, the MVVM
  Implementation is clean, complete and proper



  C THANKS

More Related Content

What's hot (20)

Servlets
ServletsServlets
Servlets
Geethu Mohan
?
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
M Ahsan Khan
?
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
Rasheed Waraich
?
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
?
伽くないSpring Bootのオ`トコンフィグレ`ション
伽くないSpring Bootのオ`トコンフィグレ`ション伽くないSpring Bootのオ`トコンフィグレ`ション
伽くないSpring Bootのオ`トコンフィグレ`ション
輿瓷 丐峠
?
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
?
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew Siemer
Andrew Siemer
?
Spring Fest 2018 Spring Bootで恬るRESTful Web Service
Spring Fest 2018 Spring Bootで恬るRESTful Web ServiceSpring Fest 2018 Spring Bootで恬るRESTful Web Service
Spring Fest 2018 Spring Bootで恬るRESTful Web Service
WataruOhno
?
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity Framework
Shravan A
?
Spring AOP
Spring AOPSpring AOP
Spring AOP
Lhouceine OUHAMZA
?
Spring AOP
Spring AOPSpring AOP
Spring AOP
Jeroen Rosenberg
?
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
habib_786
?
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
Araf Karsh Hamid
?
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
Eberhard Wolff
?
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App Presentation
Elizabeth Long
?
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
Antoine Rey
?
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
seges
?
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとりVue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Yuta Ohashi
?
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
Jonas Bon└r
?
MVVM presentation
MVVM presentationMVVM presentation
MVVM presentation
Inova LLC
?
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
M Ahsan Khan
?
伽くないSpring Bootのオ`トコンフィグレ`ション
伽くないSpring Bootのオ`トコンフィグレ`ション伽くないSpring Bootのオ`トコンフィグレ`ション
伽くないSpring Bootのオ`トコンフィグレ`ション
輿瓷 丐峠
?
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
?
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew Siemer
Andrew Siemer
?
Spring Fest 2018 Spring Bootで恬るRESTful Web Service
Spring Fest 2018 Spring Bootで恬るRESTful Web ServiceSpring Fest 2018 Spring Bootで恬るRESTful Web Service
Spring Fest 2018 Spring Bootで恬るRESTful Web Service
WataruOhno
?
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity Framework
Shravan A
?
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
habib_786
?
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
Eberhard Wolff
?
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
Antoine Rey
?
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
seges
?
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとりVue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Vue.jsて?FormをAtomic Designしてみたrのコンホ?`ネントgのテ?`タのやりとり
Yuta Ohashi
?
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
Jonas Bon└r
?
MVVM presentation
MVVM presentationMVVM presentation
MVVM presentation
Inova LLC
?

Similar to MVVM with WPF (20)

MVVM Presentation
MVVM PresentationMVVM Presentation
MVVM Presentation
Javad Arjmandi
?
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVM
Boulos Dib
?
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )
Ahmed Emad
?
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
Inocentshuja Ahmad
?
MVVM and Prism
MVVM and PrismMVVM and Prism
MVVM and Prism
Bilal Ahmed
?
Knockout js
Knockout jsKnockout js
Knockout js
Dr. Awase Khirni Syed
?
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fair
Tech_MX
?
MVC
MVCMVC
MVC
Iman Mehmandoust
?
Adopting MVVM
Adopting MVVMAdopting MVVM
Adopting MVVM
John Cumming
?
MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
Himanshu Dudhat
?
Web engineering - MVC
Web engineering - MVCWeb engineering - MVC
Web engineering - MVC
Nosheen Qamar
?
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
Betclic Everest Group Tech Team
?
Using mvvm inside mvc in domain driven design
Using mvvm inside mvc in domain driven designUsing mvvm inside mvc in domain driven design
Using mvvm inside mvc in domain driven design
yashar Aliabasi
?
MVC
MVCMVC
MVC
Devan Muthunayakan Sreemandiram
?
GUI patterns : My understanding
GUI patterns : My understandingGUI patterns : My understanding
GUI patterns : My understanding
Nitin Bhide
?
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVM
Andrei Popa
?
Mvc, mvp & mvvm (erp)
Mvc, mvp & mvvm (erp)Mvc, mvp & mvvm (erp)
Mvc, mvp & mvvm (erp)
Ayesha Maqsood
?
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
Udaya Kumar
?
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Jinkyu Kim
?
Mvvm in the real world tccc10
Mvvm in the real world   tccc10Mvvm in the real world   tccc10
Mvvm in the real world tccc10
Bryan Anderson
?
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVM
Boulos Dib
?
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )
Ahmed Emad
?
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fair
Tech_MX
?
Using mvvm inside mvc in domain driven design
Using mvvm inside mvc in domain driven designUsing mvvm inside mvc in domain driven design
Using mvvm inside mvc in domain driven design
yashar Aliabasi
?
GUI patterns : My understanding
GUI patterns : My understandingGUI patterns : My understanding
GUI patterns : My understanding
Nitin Bhide
?
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVM
Andrei Popa
?
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
Udaya Kumar
?
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Jinkyu Kim
?
Mvvm in the real world tccc10
Mvvm in the real world   tccc10Mvvm in the real world   tccc10
Mvvm in the real world tccc10
Bryan Anderson
?

Recently uploaded (20)

Mastering NIST CSF 2.0 - The New Govern Function.pdf
Mastering NIST CSF 2.0 - The New Govern Function.pdfMastering NIST CSF 2.0 - The New Govern Function.pdf
Mastering NIST CSF 2.0 - The New Govern Function.pdf
Bachir Benyammi
?
Presentation Session 2 -Context Grounding.pdf
Presentation Session 2 -Context Grounding.pdfPresentation Session 2 -Context Grounding.pdf
Presentation Session 2 -Context Grounding.pdf
Mukesh Kala
?
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdfAnsible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
RHCSA Guru
?
Packaging your App for AppExchange C Managed Vs Unmanaged.pptx
Packaging your App for AppExchange C Managed Vs Unmanaged.pptxPackaging your App for AppExchange C Managed Vs Unmanaged.pptx
Packaging your App for AppExchange C Managed Vs Unmanaged.pptx
mohayyudin7826
?
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
Achieving Extreme Scale with ScyllaDB: Tips & TradeoffsAchieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
ScyllaDB
?
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You NeededSafer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safe Software
?
Making GenAI Work: A structured approach to implementation
Making GenAI Work: A structured approach to implementationMaking GenAI Work: A structured approach to implementation
Making GenAI Work: A structured approach to implementation
Jeffrey Funk
?
B2B SaaS - Reduce Churn using Proactive Support.pdf
B2B SaaS - Reduce Churn using Proactive Support.pdfB2B SaaS - Reduce Churn using Proactive Support.pdf
B2B SaaS - Reduce Churn using Proactive Support.pdf
Vijay Chandran
?
UiPath Automation Developer Associate Training Series 2025 - Session 7
UiPath Automation Developer Associate Training Series 2025 - Session 7UiPath Automation Developer Associate Training Series 2025 - Session 7
UiPath Automation Developer Associate Training Series 2025 - Session 7
DianaGray10
?
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
All Things Open
?
How to manage technology risk and corporate growth
How to manage technology risk and corporate growthHow to manage technology risk and corporate growth
How to manage technology risk and corporate growth
Arlen Meyers, MD, MBA
?
Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5
Margaret Maynard-Reid
?
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
voginip
?
Cloud Computing The Future of Technology
Cloud Computing The Future of TechnologyCloud Computing The Future of Technology
Cloud Computing The Future of Technology
joelmcapg
?
Harnessing the Power of AI in Salesforce.pdf
Harnessing the Power of AI in Salesforce.pdfHarnessing the Power of AI in Salesforce.pdf
Harnessing the Power of AI in Salesforce.pdf
rabiabajaj1
?
Comparative Analysis of Reasoning Techniques
Comparative Analysis of Reasoning TechniquesComparative Analysis of Reasoning Techniques
Comparative Analysis of Reasoning Techniques
HoussemEddineDEGHA
?
TrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc Webinar: Strategies for Future-Proofing Privacy for HealthcareTrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc
?
I am afraid of no test! The power of BDD
I am afraid of no test! The power of BDDI am afraid of no test! The power of BDD
I am afraid of no test! The power of BDD
Ortus Solutions, Corp
?
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
jamesfolkner123
?
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
All Things Open
?
Mastering NIST CSF 2.0 - The New Govern Function.pdf
Mastering NIST CSF 2.0 - The New Govern Function.pdfMastering NIST CSF 2.0 - The New Govern Function.pdf
Mastering NIST CSF 2.0 - The New Govern Function.pdf
Bachir Benyammi
?
Presentation Session 2 -Context Grounding.pdf
Presentation Session 2 -Context Grounding.pdfPresentation Session 2 -Context Grounding.pdf
Presentation Session 2 -Context Grounding.pdf
Mukesh Kala
?
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdfAnsible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
RHCSA Guru
?
Packaging your App for AppExchange C Managed Vs Unmanaged.pptx
Packaging your App for AppExchange C Managed Vs Unmanaged.pptxPackaging your App for AppExchange C Managed Vs Unmanaged.pptx
Packaging your App for AppExchange C Managed Vs Unmanaged.pptx
mohayyudin7826
?
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
Achieving Extreme Scale with ScyllaDB: Tips & TradeoffsAchieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
ScyllaDB
?
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You NeededSafer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safer¨s Picks: The 6 FME Transformers You Didn¨t Know You Needed
Safe Software
?
Making GenAI Work: A structured approach to implementation
Making GenAI Work: A structured approach to implementationMaking GenAI Work: A structured approach to implementation
Making GenAI Work: A structured approach to implementation
Jeffrey Funk
?
B2B SaaS - Reduce Churn using Proactive Support.pdf
B2B SaaS - Reduce Churn using Proactive Support.pdfB2B SaaS - Reduce Churn using Proactive Support.pdf
B2B SaaS - Reduce Churn using Proactive Support.pdf
Vijay Chandran
?
UiPath Automation Developer Associate Training Series 2025 - Session 7
UiPath Automation Developer Associate Training Series 2025 - Session 7UiPath Automation Developer Associate Training Series 2025 - Session 7
UiPath Automation Developer Associate Training Series 2025 - Session 7
DianaGray10
?
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
All Things Open
?
How to manage technology risk and corporate growth
How to manage technology risk and corporate growthHow to manage technology risk and corporate growth
How to manage technology risk and corporate growth
Arlen Meyers, MD, MBA
?
Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5Build with AI on Google Cloud Session #5
Build with AI on Google Cloud Session #5
Margaret Maynard-Reid
?
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
Rens van de Schoot - Mensen, machines en de zoektocht naar het laatste releva...
voginip
?
Cloud Computing The Future of Technology
Cloud Computing The Future of TechnologyCloud Computing The Future of Technology
Cloud Computing The Future of Technology
joelmcapg
?
Harnessing the Power of AI in Salesforce.pdf
Harnessing the Power of AI in Salesforce.pdfHarnessing the Power of AI in Salesforce.pdf
Harnessing the Power of AI in Salesforce.pdf
rabiabajaj1
?
Comparative Analysis of Reasoning Techniques
Comparative Analysis of Reasoning TechniquesComparative Analysis of Reasoning Techniques
Comparative Analysis of Reasoning Techniques
HoussemEddineDEGHA
?
TrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc Webinar: Strategies for Future-Proofing Privacy for HealthcareTrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc Webinar: Strategies for Future-Proofing Privacy for Healthcare
TrustArc
?
I am afraid of no test! The power of BDD
I am afraid of no test! The power of BDDI am afraid of no test! The power of BDD
I am afraid of no test! The power of BDD
Ortus Solutions, Corp
?
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
IObit Driver Booster Pro Crack 12.2.0 with License Key [2025]
jamesfolkner123
?
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
All Things Open
?

MVVM with WPF

  • 1. M-V-VM Model View ViewModel for WPF (Design Pattern)
  • 2. Highlights Created By John Gossman (WPF and Silverlight Architect at Microsoft) This pattern is a simple and effective set of Guidelines for Designing and Implementing a WPF application Allows you to create a strong separation between data, behavior and presentation (UI)
  • 3. Uses Databinding for 2 way communication between View (UI) and ViewModel Uses Command pattern (ICommand interface) for communicating actions or events that happen on View (UI) Dependency Properties alongwith Data Binding to communicate data changes to and from the View (UI)
  • 5. What is View, Model and ViewModel? View ViewModel Model ? represents the UI that the end ? is the abstraction of the View ? Represents the data classes user sees (UI) and contains the data, bound ? can be a user control or Data ? Communicates data to view and modified by view Template modifications to the Model ? Hold only the data or ? shouldn¨t contain any logic or from the View information related to an code that is to be tested ? Data changes in Model are Object; reflected in the View through ? It doesn¨t contain the ViewModel by making use of behaviors or services that data Binding and dependency manipulate this data or properties information, though sometimes it may contain data View knows validation logic Multiple Views : 1 ViewModel, ViewModel ? Example is ^The Contact 1 View : 1 ViewModel ViewModel (for Wizard information of a person ̄ like knows Model, but not kind of applications) Name, Phone vice versa No, Email, Address, Zip Code etc.
  • 6. Advantages ViewModel classes are easy to unit test the complete UI without touching the UI code Testing through ViewModel provides free and fast regression testing which helps to reduce cost of maintaining application over time Helps create a smooth Designer/developer workflow ? Design team can focus on creating user-friendly views while, ? Development team can focus on creating robust ViewModel classes ? Which can then be integrated to ensure proper data bindings exist in the View¨s XAML file Takes full advantage of WPF¨s Data Templates and Commands Gives more flexibility to change UI without having to refactor the logic or change other code base
  • 7. What do u need to Understand in Order to Learn and Implement MVVM Data Binding in WPF ? http://msdn.microsoft.com/magazine/cc700358 Command Pattern Implementation in WPF ? ICommand Interface usage public interface Icommand { bool CanExecute(object param); void Execute(object param); event EventHandler CanExecuteChanged; } ? RelayCommand pattern ? Routed Events and Commands in WPF ? http://msdn.microsoft.com/magazine/cc785480 Composite Application Library from Microsoft ? http://msdn.microsoft.com/library/cc707890 For Unit Testing: ? Nunit ? Moq Framework for .Net (Third Party classes for testing .Net Apps)
  • 8. References and Resources WPF Model-View-ViewModel Toolkit ?http://wpf.codeplex.com/wikipage?title=WPF%20Model-View-ViewModel%20Toolkit MVVM Foundation on codeplex (A set of classes that helps build WPF Apps based on MVVM) ?http://mvvmfoundation.codeplex.com/ Super Simple MVVM Explained video: ?http://www.charlieblog.net/SuperSimpleMVVM/Large/SuperSimple_MVVM_large/SuperSimple_MVVM_large.html MVVM MSDN Article: ?http://msdn.microsoft.com/en-us/magazine/dd419663.aspx MVVM Channel9 video with Karl Shifflett ?http://channel9.msdn.com/shows/Continuum/MVVM/ WPF MVVM Video by Jason Dolinger ?http://hugeonion.com/2009/03/08/wpf-mvvm-video-by-jason-dolinger/ MVVM Explained ?http://csharperimage.jeremylikness.com/2010/04/model-view-viewmodel-mvvm-explained.html
  • 9. Last Note on MVVM ? It is said that if you have not given names for your UI Elements and still able to run and process the application properly, the MVVM Implementation is clean, complete and proper C THANKS