Sunday, November 04, 2012

Combining TinyMessenger with MvvmCross to provide "StartViewModelForResult" type behavior

See http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/

A sample from @gshackles

https://gist.github.com/f20d5f444234c78ca81a

Basically this pattern allows you to write a flow like:

- navigate from a parent viewModel to a child ViewModel
- the child viewModel collects some user input
- the user then presses OK
- a message is sent back from the child ViewModel  to the parent
- the child view then closes

We think there might be one very minor issues in this pattern - to do with some tombstoning edge cases - but for most apps this should work really well - and it has a nice test harness too!

No comments:

Post a Comment