I was wondering when is more appropriate to save the view model of the single pages.
I see two possibilities:
Which is the correct way of handling it?
Thx Simone
Unfortunately the "best" time to save the state will depend on: the application; the complexity of the models used by each page; the interaction that each page supports; and the complexity of models shared between pages (at the app level).
As a general rule I try and have a single model at the application level and persist that on activation/deactivation. The model for a page is a reference to part of the app level model and I only persist page specific information on navigation from/to a page.
Examples of page specific information I persist are: entered but unsaved data; and scroll positions.