FreshMvvm binding and object state

196 Views Asked by At

I'm new to Xamarin dev and freshmvvm and am looking for the best practice around editing objects. Ideally I would like to select an object from a list on one page, view the detail on the next page, and edit on a modal form with an option to cancel or save. Two-way binding is great for saving but not so good when canceling since changes to the object persist all the way back to the list. One-way binding prevents that from happening but requires more work to save...sort of defeating the purpose of binding.

I looked at the sample apps with FreshMvvM (contact and quote) and see that the problem is there and is unhandled...meaning that if you make changes to a contact or quote and cancel rather than save, the change persists back to the original list.

I like FreshMvvm and would like to work around this. Appreciate advice and some guidance on best practice of this kind of thing from a high level. Thanks!

1

There are 1 best solutions below

0
On

You can pass the item from list source to the detail page / edit page by Command on the listview and it will keep track of the object. When you navigating back to the list page, you can call RaisePropertyChange on that object to refresh the property and get the updated value from edit page / detail page.