Like Eddy said, there is no right or wrong to do it, using observable collections, you could have 2 and a flag, if the record is dirty (meaning that was modify) then in the save event in your viewmodel you just save the record, if cancel was hit and it was dirty then restore from either the db. again (re-read the record) or copy it from the other collection. What I mean with the 'imports' is that the 'Message' needs a import on the viewmodel.
C
cocis48
@cocis48
Posts
-
Best way for 'OK' and 'Cancel' button implementation in a modal dialog -
Best way for 'OK' and 'Cancel' button implementation in a modal dialogI don't know why you cloned the object, if the collection keeps the current record, you can save the index of it and if cancel is clicked, remove from the collection and only save when the save button is click, here is a small sample, just play with this and see if it can help you. 1-You need to implement commanding in your project (you are already doing it) 2-in your view link you button to a command in your viewmodel Example a Save button: 4-remember your imports, this way you can display on the view the message for the user to answer and don't need to clone.