c# - Correct way to save data with mvvm when navigating between pages -
i'm working on universal app i'm confused best way save data when using mvvm. i'm using mvvm light project
i have page (i.e. locationspage) listbox binded observable collection contains objects of type locationviewmodel.
there 'new' button @ bottom of locationspage allow user create new location.
when clicked, navigates page i.e. locationpage.
this page contains necessary fields create new location , @ bottom of page, have 'save' button.
when clicked, want returned locationspage contains list , add newly create location list , want save data file.
is there way achieve without using code-behind (i.e. onnavigatedto, onnavigatedfrom)?
i know quick fix make observable collection global between pages newly created location object added directly don't idea honest.
can point me in right direction on how best handle this?
thanks.
perhaps passing collection "child" view model? or parent view model ilocations has addnew method?
Comments
Post a Comment