且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

编辑的ObservableCollection的的SelectedItem不绑定控件眼看编辑,直到它们被保存

更新时间:2021-09-15 18:13:36

我会去某个版本的第二个选项。基本上,这是 MVVM 格局的变化而被认为是正确的方式做WPF / Silverlight的代码。基本上你应该有一个模型视图对象为每一个屏幕(查看),它包装的型号和公开的格式特定于视图,以便它不正是模型什么的查看需求并没有更多的。

I would go with some version of the second option. Basically this is a variation of the MVVM pattern which is considered the "right" way to do WPF/Silverlight code. Basically you should have a ModelView object for each "screen" (View) that wraps the model and exposes the model in a format specific to the View so it does exactly what the View needs and NO MORE.