Top Banner
1 MVVMmmmmmmmmmmm Ward Bell VP Technology, IdeaBlade Twitter: @wardbell Blog: http://neverindoubtnet.blogspot.com/
38
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

MVVMmmmmmmmmmmm

@wardbell http://neverindoubtnet.blogspot.com/1

NotesSpend more time on why and what goes wrong if you don t Diagram involving ViewModelLocator Diagram involving Repository/DataService Show example of working too hard to eliminate code-behind Clearly distinguish data binding, view state binding, command binding VisualStateManager Review http://www.wintellect.com/CS/blogs/jlikness/archive/2010/04/14/model-view-viewmodel-mvvm-explained.aspx. Grist for the mill. What MVVM is NOT Likness Visual State Aggregator? Repository pattern and my guidelines Testing

2

Thanks for the slide deck, John Papa

3

Agenda

4

Bookshelf in Action

5

Model View ViewModel

6

Everybody s doing it!

7

MVVM

View

Model

8

MVVM

ModelVie

9

MVVM

Vi wM l

10

11

MVVM

View ViewModel

Model

12

MVVM

ViewMView

elM el

13

MVVM

Vi wVi wM l M l

14

Benefits of MVVM

15

MVVMBinding Design w/ XAML

ViewModel

Presentation logic Tell View when data changes

View(e.g. Person Master/Details)

Model(e.g. PeopleModel/Person)

XAMLCode

Not reusable

16

Binding a View to a ViewModel

17

Responding to User Actions

18

Handling User ActionsCommands ButtonBase support ICommand Toggle IsEnabled (CanExecute)

Be aviors

For ot er actions EventToCommand and InvokeCommandAction

19

Commands and Behaviors

20

Services and Separation

21

MVVM + ServicesVM V M ViewModel Services Perform operations Presentation logic Reusable tasks Handle user interaction Reference ModelsRe s ble ervices

View

Mo el

22

Separating the Services

23

Adding Value with Services

24

RIA Platforms and MVVM

25

RIA Platforms

26

DevForce and MVVM

27

MVVM + MessagingVM V MDirect Message?

VM V M

28

MVVM + MessagingEventAggregator Pattern VM V MPublish

VM V Messaging ServiceSubscribe

MSubscribe

Confirmation Dialog29

Confirmation Dialog Example(ConfirmationDialogMessage)

(BookSaver:SaveSuccessful) (MainPage:DialogMessageReceived)

30

Messaging

31

Blendability & Design Time Data

32

Design Time Data

What am I looking at? Are my bindings right? my layout? Hows

Ah!Isnt this easier/more productive? Notice Ive tested my Submit Button Logic

33

Swapping Services

34

Blendability: Data in the Designer

35

Automated Testing

36

Review: Benefits of MVVM

37

Summary

38

ResourcesWeb:www.ideablade.com links.ideablade.com/drc-bookshelf links.ideablade.com/firestarter10-mvvm links.ideablade.com/mix10-laurent-mvvm links.ideablade.com/mvvmlight links.ideablade.com/sl-utf

Print: Laurent Bugnion39