Question

Within Mvvmcross when you want to navigate to a different viewmodel you call

ShowViewModel<T>();

within a viewmodel that derives from MvxViewModel. All that is fine but I'm wondering why it serializes and deserializes when you do the likes of:

ShowViewModel<T>(new Person("firstname", "lastname"));

I'm fine that it does of course, and I can think of a few reasons why it does that but I'd like to have it spelled out here as it may also help others understand what's happening at a lower level within MvvmCross. Thanks in advance.

Was it helpful?

Solution

Because on Windows Phone and Android you can't just pass anything between Pages or Activities. On Windows Phone you have URL's that you can give a Page, which MvvmCross uses by adding your serialized parameters to it. On Android you have Intent's where you can put extra strings, bools etc. So it also serializes it and adds that as an extra thing in the intent.

Not sure how it works on iOS but that is basically the reason as to why. If you have a better way to do this, I suggest you make a pull request :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top