Windows phone 8 (mvvm)

10
Sapan Patel. sapan@ipowersoftware s.com +91-9712363687

Transcript of Windows phone 8 (mvvm)

Page 1: Windows phone 8 (mvvm)

Sapan Patel.

[email protected]

+91-9712363687

Page 2: Windows phone 8 (mvvm)

What is MVVM ?

MVVM is a design patterndesign pattern

MVVM stands for Model-View-ViewModel Model-View-ViewModel

Page 3: Windows phone 8 (mvvm)

The ViewRepresents the user interface that the user will

seeCan be a page, user control or Data Template

Clean code-behindOnly visual logic (all the rest should go in

the ViewModel)Should never contain anything that is to be

testedModel-related

Page 4: Windows phone 8 (mvvm)

The ModelData model, service reference/proxy classes,

Very often, an extra layer is added on top of the generated proxy classes

Validation logicData accessNo reference to ViewModel

Page 5: Windows phone 8 (mvvm)

ViewModel

It contains all the data that needs to be displayed and procedures to modify the model at will.

The magic about MVVM is that the ViewModel knows nothing about the View.

State Operations Not dependent on the view

Page 6: Windows phone 8 (mvvm)

Data ModelData Model

ViewView

XAML

Code-BehindCode-Behind

View ModelView Model

State + State + OperationsOperations

Send notification

Data-binding and commands

Change notification

Page 7: Windows phone 8 (mvvm)

MVVM MVC

**11**

11

Page 8: Windows phone 8 (mvvm)

viewmodel

navigation

resourcesweb

services

hardware

Page 9: Windows phone 8 (mvvm)

Benefits of MVVM

Loose coupling Testable code Maintainable code

Page 10: Windows phone 8 (mvvm)

Thank You!