mvvm
I've currently noticed that many people start using this model very often. Anyways, I think it's very correct to separate logic from presentation. What more, some functionalities cannot be accomplished without it, or just very hardly. Consider a Tree that is selectable, has search capabilities etc.. But in some cases, you don't need to implement this MVVM model, although people do it.
Do you think it's correct? Wasn't the purpose of WPF to simplify coding - try to do the majority of work in XAML?
I have a feeling, that this model is often misused just for the elegance of the design, but breaks the WPF efforts.
Or am I completely wrong?
imho WPF is designed to use MVVM, so if you writing your code without this pattern will lead you sooner or later into a situation where you have to do some hacks to solve problems.
For me there are very few reason not to use MVVM, like private projects, tryout's, ...
In larger projects, everything should be written in MVVM because of the capabilities of this design pattern (enabling unit tests, prevent miss-use of UI, ...)
The main purpose of seperating logic from UI is for the testability. Since you are putting all logic under ViewModel, you can write the test script for testing your logic without UI.
问题在于缺少工具,所以当有人不得不写一半的代码来点击一个按钮时抛出一个消息框时,很难指定wvvm。
链接地址: http://www.djcxy.com/p/20274.html上一篇: 带有MVVM模式的WPF OpenFileDialog?
下一篇: MVVM