I read about “ViewModel to ViewModel navigation” and “View Model Lifecycle” from here: https://github.com/MvvmCross/MvvmCross/wiki/ViewModel--to-ViewModel-navigation https://github.com/MvvmCross/MvvmCross / wiki / View-Model-Lifecycle
I can use the Init () or Start () methods to initialize the current ViewModel. I can also pass parameters from one ViewModel to another and get it in the Init () method.
So my question is: When I created applications for Windows phones, I used the "NavigateTo" and "NavigateFrom" methods. Init () is similar to "NavigateTo". But I did not find an alternative for the “NavigateFrom” method in mvvmcross, and I do not know how to reload the data when I move “back” to “Close (this)” or using the “Back” button on a Windows phone.
Could you give me a hint?
Thanks in advance!
updated
I found out that Messenger (the MvvmCross plugin) can help me inform the first ViewModel when another second ViewModel has changed the data (for example, add an item to the collection). Therefore, when the second ViewModel adds a new element, the ViewModel first reloads the data in the OnCollectionChanged (CollectionChangedMessage obj) method.
Stuart showed how to work with this plugin in NPlus1DaysOfMvvmCross / N-13-CollectABull-Part2. Link here: https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/tree/master/N-13-CollectABull-Part2
source share