MVVM Made Easy Paul D. Sheriff PSheriff@pdsa.com .

Post on 04-Jan-2016

214 views 1 download

Tags:

Transcript of MVVM Made Easy Paul D. Sheriff PSheriff@pdsa.com .

MVVM Made Easy

Paul D. SheriffPSheriff@pdsa.comwww.pdsa.com

DEV216

Paul.About

Paul D. Sheriff (psheriff@pdsa.com)President of PDSA, Inc.Author, Speaker, ArchitectCustom Software Development, Developer ToolsSoftware Auditswww.pdsa.com

Developer ToolsHaystack Code Generator

www.CodeHaystack.com.NET Productivity Framework

Agenda

What is MVVM?Why use MVVM?Demos

Starting with little Data BindingAdd More Data BindingAdd a View Model

What is MVVM?

Model-View-ViewModelModel = Data ClassView = User InterfaceViewModel (VM)

UI binds to this classVM consumes services of ModelVM may expose services/properties of Model

What is MVVM?

View knows nothing about ModelModel knows nothing about ViewModel knows nothing about View ModelView Model knows nothing about ViewCommunication from View to VM is via data binding

Lists for List Boxes and GridsIsEnabled properties for ButtonsData for Text Boxes

Why Use MVVM

Separate UI / Business / Data LogicBe able to swap out UI

Leave business rules/data logic in placeASP.NET to SilverlightWPF to Windows Phoneetc.

Unit TestingWrite less UI code

Demos

Data Binding ReviewData Binding using ClassSearching SampleViewModel for Add/Edit/Delete screen

Summary

MVVM is easyJust need an additional classHelps to understand the XAML data binding modelGreat for testing and re-usabilityDon’t worry about being “100% code-behind free”

Thank You

Sign up for Haystack Webcastshttp://www.pdsa.com/webcasts

Sign up for Paul Sheriff's Inner CircleLifetime membershipOver $2000 worth of ebooks, video, etc.http://www.PaulSheriffInnerCircle.com

Sample Code

http://www.pdsa.com/TechEdGet Free Silverlight Video

Silverlight XAML for the Complete Novice - Part 1

** Haystack Special **Special Price: $499Use Code: TECHED12Valid until: 08/01/12

DEV Track Resources

Visual Studio Home Page :: http://www.microsoft.com/visualstudio/en-us

Jason Zander’s Blog :: http://blogs.msdn.com/b/jasonz/

Facebook :: http://www.facebook.com/visualstudio

Twitter :: http://twitter.com/#!/visualstudio

Somasegar’s Blog :: http://blogs.msdn.com/b/somasegar/

Resources

Connect. Share. Discuss.

http://northamerica.msteched.com

Learning

Microsoft Certification & Training Resources

www.microsoft.com/learning

TechNet

Resources for IT Professionals

http://microsoft.com/technet

Resources for Developers

http://microsoft.com/msdn

Complete an evaluation on CommNet and enter to win!

MS Tag

Scan the Tagto evaluate thissession now onmyTechEd Mobile

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.