IEditableObject in MVVM

前端 未结 3 427
耶瑟儿~
耶瑟儿~ 2020-12-28 10:05

Can you think of a scenario where IEditableObject would be still usefull in an MVVM-based WPF application? If so, do you have an example that demonstrates this.

3条回答
  •  孤独总比滥情好
    2020-12-28 11:00

    I have used IEditableObject in one of my applications. For example if you have a dialog for editing something, you could implement IEditableObject on your ViewModel. You call BeginEdit() when the dialog opens, EndEdit() when the user clicks OK, and CancelEdit() when the user clicks cancel.

    IEditableObject is a good interface anytime you want to be able to roll back changes.

提交回复
热议问题