My screen has a list of objects of type Person
, and a form that displays the person properties (name, address, weight, etc.) via databinding.
I want to be able to:
- Click in a button "Edit properties", and start modifying the person's properties (I can already do that using
Command
s in the ViewModel); - If I click "Cancel", the edited info "rollback" to the original unmodified values of that person;
- If I click "Save changes", JUST THEN the person's name changes in the person list.
My problem right now is that, as I am editing the forms, the original properties are updated, so to say, in realtime, and if I decide to cancel, I have not the original values to "go back".
I considered to Clone
the selected person, but that seemed to be odd. I think a better approach would be to change only the text properties of the field, and update back only when clicking to submit changes, but I don't know how to do it, specially how to preserve databinding consistency.