c# - MVVM Cross - passing parameters -
i'm trying pass objects across view models in mvvm cross. here's code vm i'm passing from:
private void callvm2() { myobj newobj = new myobj(); imyservice myservice = new myservice(); dictionary<string, object> p = new dictionary<string, object>() { {"myobj", newobj}, {"myservice", myservice} }; showviewmodel<viewmodel2>(p); }
and here's code viewmodel2:
public void init(dictionary<string, object> p) { }
okay - tried initfrombundle
too, appears need init
. can't work out how or why gets called, does. doesn't populate parameters.
so, questions are:
- how , why
init
called mvvm framework (assuming correct method)? - should using
initfrombundle
, if not, for? - why code not pass through dictionary of objects init, , how can make it?
mvvmcross relies on underlying platform navigation mechanisms - eg things intents on android , urls on windows phone.
because of doesn't support navigation object - navigation few small serializable types - see https://github.com/mvvmcross/mvvmcross/wiki/viewmodel--to-viewmodel-navigation more information.
if want navigate more complex serializable objects, can extend view model classes support - see passing complex navigation parameters mvvmcross showviewmodel
Comments
Post a Comment