Hands On MVVM

Download Report

Transcript Hands On MVVM

Data Binding
Without INotifyPropertyChanged
Image Credit:
Slides and Code
• updatecontrols.net/doc/inpc
Michael L Perry
•
•
•
•
•
qedcode.com
@MichaelLPerry
Update Controls
Correspondence
Client App Dev
Dan Bricklin and Bob Frankston
y=1/(1+x2)
1.2
1
0.8
0.6
0.4
0.2
0
-3
-2
-1
0
1
2
3
Stateful View Models
PersonListViewModel
Person
Selected
PersonSummary
FullName
Name
Changed
PersonViewModel
FirstName
LastName
FullName
Person
Selected
Name
Changed
Stateless View Models
PersonListViewModel
PersonSummary
PersonList
Person
FirstName
LastName
PersonViewModel
Navigation
SeletedPerson
Two Way Connection
* Independent
Dependent
*
Updating
Person
View
TextBlock
FullName
Person
ViewModel
get
Person
(Model)
_firstName
_lastName
Dependent
“FullName”
Independent
Independent
Modifying
Person
View
Person
ViewModel
TextBlock
TextBox
FirstName
Dependent
“FullName”
Person
(Model)
get
_firstName
set
_lastName
Independent
Independent
MVVM Idioms
•
•
•
•
•
•
Dependent Properties
Dual
Tuple
Navigation
Equals/GetHashCode
Command Binding
Michael L Perry
•
•
•
•
@MichaelLPerry
[email protected]
updatecontrols.codeplex.com
updatecontrols.net/doc/inpc