I'm just getting into my first project with (the unbelieveably excellent) MVVMCross and I can't figure out how to do something that seems fairly basic: composite views.
Suppose I've got a Person
(FirstName, LastName, etc), and a person has an Address
(Street, City, PostalCode, etc.). So I'll also have a PersonViewModel
and an AddressViewModel
.
This is a strictly tablet based app (iPad only, actually) and I want to use containment to have the PersonView
contain the (reusable) AddressView
, such that the outer (person) view binds to Person
, while the inner (address) view binds to Person.Address
.
I (dimly) understand the presenter concept for showing the views, as discussed here, but I can't see how to handle the propagation of changes from Person to Address and back.
Suppose the Person object has an Address object, but the PersonViewModel
shows the AddressViewModel
in an AddressView by passing some sort of Address id and rehydrating. Then the AddressView is binding to a different Address object than the one the Person contains. I don't see how to keep the two in sync, which of course would defeat the whole purpose of binding.
How should I do what I'm trying to do?