14
Model View ViewModel

MVVM

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: MVVM

Model View ViewModel

Page 2: MVVM

Felipe PimentelFelipe Pimentel

Page 3: MVVM

Felipe Pimentel

[email protected]@2pc.com.brhttp://felipepimentel.net

Page 4: MVVM

Felipe Pimentel

Page 5: MVVM

Agenda

• O que é?• O que faz?• Quando usar?• Variações?• Light Toolkit• Demo!!!

Page 6: MVVM

“Mais outro M* alguma coisa?”MVPMVC

MV?????

Page 7: MVVM

O que é MVVM?

• Padrão de arquitetura de apresentação• Separando responsabilidades• Isolar designers e desenvolvedores?• Facilita os testes

Page 8: MVVM

Por que do MVVM?

• Fatores tecnologicos– Databinds– INotifyPropertyChanged– IValueConverter–Modelo de eventos utilizando ICommand

Page 9: MVVM

MVVM

Model View

Presentation Model

(ViewModel)

DataBinding

Page 10: MVVM

ModelMVVM

• Represents the data• The entity• Not required to know where it gets its data

from– From a WCF service. WCF RIA Services, etc

• May contain validation

Page 11: MVVM

ViewMVVM

• The screen, the UI, the UserControl in Silverlight• Handles UI look and feel• Presentation of information• Communicates with ViewModel through bindings

Page 12: MVVM

ViewModelMVVM

• Conhecido por Presenter Model• Main source of logic for the MVVM triad• Connects the Model to the View• Abstracts the View• Public properties that are bound to a View• INotifyPropertyChanged and INotifyCollectionChanged

talk to the View through bindings• Listens for changes from the View through bindings• Invokes services to communicate outside the MVVM

triad

Page 13: MVVM

MVVM

• DEMO!!!!• DEMO!!!• DEMO!!• DEMO!

Page 14: MVVM

Referências

• John Papa - http://johnpapa.net/• http://www.galasoft.ch/mvvm/getstarted/• http://

msdn.microsoft.com/en-us/magazine/dd419663.aspx

• http://virtualdreams.com.br