开发者

Editing Records with MVVM/MVVM-Light

I have created a very simple wpf app with mvvm light.

I have rows in a list view, these are templated representations of Book objects. I can click a row, then click an edit button, this button loads a new window and sends the new window the book to edit (using mvvm-light's Messenger).

The issue I have is when I edit the record in my new w开发者_StackOverflow社区indow the data on the main form is updated. The text boxes are bound to the object received via the Messenger.

I know this is because I have essentially passed a reference to the same Book object around the place, therefore I update in one place.. and voilà it updates on the main page too.

What I would like to know is.. is there a standard way/method/concept to achieve what I am trying to do? i.e. create an "edit" page/screen with the option of discarding the edits?

thanks.


Could you make your entity implement ICloneable and create a clone for editing?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜