mvvm in windows phone 7

13
7 Name Title Microsoft Corporation MVVM in Windows Phone 7

Upload: chris-koenig

Post on 10-May-2015

3.325 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: MVVM in Windows Phone 7

7

NameTitleMicrosoft Corporation

MVVM in Windows Phone 7

Page 2: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 2

MVVM – In a nutshell

“…building UIs that utilize platform enhancements in WPF and Silverlight to provide good separation between UI and business logic in order to make those UIs easier to maintain by developers and designers.”

- Glenn Block

Page 3: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 3

Key elements of MVVM Data

Binding

Data Templates

Commands

Attached Properties

Behaviors

Page 4: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 4

MVVM toolkits for WP7 Homegrown

Ships with template MVVM Light

http://mvvmlight.codeplex.com NRoute

http://nroute.codeplex.com Caliburn

http://caliburn.codeplex.com

Data Binding

Commands

Messages

View

Model

ViewModel

Page 5: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 5

MVVM toolkits for WP7 ViewModelLocator ViewModel DispatcherHelper RelayCommand EventToCommand Messenger

“Blendability”

Page 6: MVVM in Windows Phone 7

Demo - Getting Started

Page 7: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 7

Relay Command Used to send messages from the View to

the ViewModel Bind actions on View to Commands on

ViewModel Based on the familiar Command pattern

ICommand Command Parameters CanExecute Attached Properties

Page 8: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 8

EventToCommand Blend Behavior for wiring up

RelayCommands

Page 9: MVVM in Windows Phone 7

Demo - Commands

Page 10: MVVM in Windows Phone 7

Windows Phone Microsoft confidential. 10

Messaging

© 2010 IdentityMine Inc. Used with permission

View

ViewModel

Messages

Messages+ callback

View

ViewModel

View

ViewModel

Page 11: MVVM in Windows Phone 7

Demo – Messaging

Page 12: MVVM in Windows Phone 7

Q&A

Page 13: MVVM in Windows Phone 7

© 2010 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.