An Introduction to the Model-View-ViewModel Pattern Srsly? Another MV* Pattern? Srsly? Another MV* Pattern?

Slides:



Advertisements
Similar presentations
Expression Blend 4 – deep dive
Advertisements

Silverlight is dead! Long live MVVM!
Understanding the MVVM pattern
Patterns & practices Symposium 2013 Tips for building a Windows Store app using XAML and C#: The Kona project Francis Cheung
Developing HTML5 Application using MVVM pattern Pekka Ylenius.
UI Application Logic Out of the box approach View ViewModel Model Model-View-ViewModel (MVVM)
MVVM: Filling the Pattern Gap in Silverlight Application Development Bart McDonough Principal Consultant Incline Technical Group.
USING THE MODEL-VIEW- VIEWMODEL PATTERN Laurent Bugnion Director, User Experience Integration IdentityMine
Dinko Jakovljević Microsoft Student Partner | BambooLab
Essentials of Developing Windows Phone Apps Chinthaka Dissanayake Tech Lead Exilesoft.
Or How I Learned to Stop Worrying and Love the Binding Bryan Anderson.
WinRT Apps
An Introduction To Silverlight Gergely Orosz
Laurent Bugnion Senior User Experience Integrator IdentityMine
WPF MVVM Training Michael Sync (Silverlight MVP).
Microsoft Focus & Expertise We have a world-class team of Microsoft experts that can make any other platform integrate better with an existing enterprise.
Laurent Bugnion Director, UX MVVM Powers Silverlight Development.
Building an end-to-end Silverlight 4 application Write your Christmas cards with Silverlight! Gill Cleeren Microsoft Regional Director – MVP ASP.NET.NET.
Real world Windows Phone development Igor
Building Silverlight Applications Using the MVVM pattern An Introduction by Peter Messenger Senior Developer – Qmastor
Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd.
Joe xamlcoder.com/blog Silverlight / WPF Consultant.

© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg.
Hot Tuna CROSS PLATFORM DEVELOPMENT WITH.NET, XAMARIN AND MVVMCROSS.
@benday #vslive Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
.NET Database Technologies: Introduction to WPF and Entity Framework DataBinding.
Building an Offline Smart Client using Domain-Driven Design Principles Tim McCarthy.
Windows Phone MVVM and Unit Testing Step by Step Andy Wigley Windows Phone Development MVP, Mobile Software Consultant APPA Mundi Ltd WPH208.
Nikhil Kothari Software Architect Microsoft Corporation Session Code: WUX312.
Jordan Knight Senior Consultant Readify ARC 301 About Me Jordan Knight Senior Consultant at Readify
The Start Menu……..Exposed What you never knew existed.
Windows 10 UWP MVVM In Depth
Overview of the MVVM pattern for Silverlight and WPF.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
Platform abstractionSeparate UI and logic.
Data Binding Without INotifyPropertyChanged Image Credit:
V 1.0 Programming III. Automatic notifications with data binding (…Changed, INofityPropertyChanged, ObservableCollection, DataTemplate) Data formatters.
Model View ViewModel Architecture. MVVM Architecture components.
Testing WebForms w/ Model-View-Presenter Erik Peterson.
MVVM Pattern Mahender Senior Software Engineer United Health Group.
Windows 8 apps and the MVVM pattern SILVERLIGHTSHOW.NET WEBINARS SERIES GILL CLEEREN, October 16 th
Programming with MVVM Miguel A. Castro Architect -
Understanding Dependency Injection… and those pesky containers Miguel A. Castro Architect -
Vladimir Milev New Venture Software Sharing Code between WPF and Universal Apps.
/DEV/TM #1 Building Cross-Platform Apps with Xamarin and MvvmCross Flavius-Radu DEMIAN.
Igor Ralić igrali.com Open source u razvoju Windows Phone aplikacija.
Benjamin Unit Testing & Test-Driven Development for Mere Mortals.
The cutting edge event for ITPros and Devs December 7-8, 2013 Athens, Greece Fix it once use it everywhere Elias Markelis MCT, Windows Phone Enthusiast.
Adam Schultz MVVM and WPF. MVVM Model, View, ViewModel A software architecture designed to separate out User Interface design, Business Logic, and Data.
In Windows 8 Store Applications
State of the Art in Mobile Development - AndRES Käver, 2016
Real world Windows Phone development
MVVM Made Simple with Prism
Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
Ben Riga 02 | Basics of View Models Ben Riga
Build Windows 10 UWP MVVM Apps with Prism
Building Web Applications with Microsoft ASP
It’s a Knockout! MVVM Style Web Development
Miguel A. Castro Architect IDesign
Introduction to the MVVM Pattern
Integrating Security Roles into Microsoft Silverlight Applications
An introduction to MVVM using WPF NISCHAL S
Tech Ed North America /1/2018 4:27 PM Required Slide
What’s new for Windows 8 Devs Part 2
XAML Deep Dive for Windows & Windows Phone Apps Jump Start
Architecting Silverlight Applications with MVVM
Bringing existing managed code into Metro style apps
Tech Ed North America /6/2019 2:07 PM Required Slide
An Introduction to the Model-View-ViewModel Pattern
Presentation transcript:

An Introduction to the Model-View-ViewModel Pattern Srsly? Another MV* Pattern? Srsly? Another MV* Pattern?

How I Got Into MVVM

The Healthcare Application  Screenshot of WebStation

The Generalized Problem

What We Want

How Do We Achieve that? View ViewModel Model

A More Complete Diagram View XAML, Code Behind Unit Tests Integration Tests ViewModel Properties, Commands, View Logic Bindings Actions Model Service Proxies Web Data Events Behavior

Twitter Search Demo Using MVVM

Emerging Technology We’re still trying to figure out the Best Practices

Standing on the Shoulders of Giants  MVC  MVP  Presenter Model  MVC  MVP  Presenter Model  Martin Fowler  Josh Smith  John Gossman  Sean Wildermuth  Martin Fowler  Josh Smith  John Gossman  Sean Wildermuth

Compared to…

Mini Patterns

NotifyPropertyChanged public interface INotifyPropertyChanged { event PropertyChangedEventHandler PropertyChanged; } public interface INotifyPropertyChanged { event PropertyChangedEventHandler PropertyChanged; }

Command Pattern public interface ICommand { bool CanExecute(object param); void Execute(object param); event EventHandler CanExecuteChanged; } public interface ICommand { bool CanExecute(object param); void Execute(object param); event EventHandler CanExecuteChanged; } public class DelegateCommand : ICommand { public DelegateCommand( Action command, Predicate canExecute); } public class DelegateCommand : ICommand { public DelegateCommand( Action command, Predicate canExecute); }

Event Aggregator Pattern

Attached Behaviors <TextBlock Foreground=“Red” Width=“200” Behaviors:Update.WhenTextChanged=“True” /> <TextBlock Foreground=“Red” Width=“200” Behaviors:Update.WhenTextChanged=“True” /> TextBlock FontSize Foreground Width … Trimming Behavior

MVVM Guidelines 1. Reduce or eliminate your code-behind 2. Bind all of your UI inputs/outputs to your ViewModel 3. Implement INotifyPropertyChanged on your ViewModel 4. Put your view behavior into the ViewModel 5. Do not put any view state into the model 6. Only bind to a model object if there is no view-specific info 7. When testing, treat ViewModel as the Real UI 8. Avoid events. Use commands instead 1. Reduce or eliminate your code-behind 2. Bind all of your UI inputs/outputs to your ViewModel 3. Implement INotifyPropertyChanged on your ViewModel 4. Put your view behavior into the ViewModel 5. Do not put any view state into the model 6. Only bind to a model object if there is no view-specific info 7. When testing, treat ViewModel as the Real UI 8. Avoid events. Use commands instead

Third Party Support  Prism  MVVM Light  Caliburn  Silverlight FX  Prism  MVVM Light  Caliburn  Silverlight FX

Demo – CodeMash App

Who Creates the ViewModel? XAML View Constructor Other ViewModel Marriage Dependency Injection XAML View Constructor Other ViewModel Marriage Dependency Injection

Silverlight [Unit|Integration|Functional] Testing  Nunit/Moq  Silverlight UT  White  Telerik WebAI  Nunit/Moq  Silverlight UT  White  Telerik WebAI

Contact Info OPEN SPACES OPEN SPACES