开发者

Editing Records with MVVM/MVVM-Light

开发者 https://www.devze.com 2023-01-27 05:30 出处:网络
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 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

精彩评论

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