问题描述
我使用所有在我的应用程序可观察的集合。我的问题是,当我使用弹出窗口编辑这些实体,我的绑定列表越来越当用户更改窗口的相应字段改变。
I am using observable collections all around my applications. My problem is that when i use a popup window for editing those entities, my bound lists are getting changed when the user changes those corresponding fields in the window.
如何能简单地冻结观察到的变化norifications,并释放他们,只有当实体保存?
How could i simply freeze the observable changes norifications, and release them only when the entity is saved?
谢谢,
奥兰
推荐答案
您可以做一个的要编辑。这样一来,就可以在编辑,而不保留在列表中的原始干扰上的副本行事。一旦你`重新完成编辑,您可以通过编辑后的版本或回滚替换原来的。
You could make a deep copy of the object you want to edit. This way, you can act on the copy while editing, without interfering with the original that remains in the list. Once you`re done editing, you can replace the original by the edited version or rollback.
这篇关于WPF的ObservableCollection编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!