WPF。 MVVM。使用事件是一个不好的口气?是一个、口气、不好、事件

2023-09-06 22:02:29 作者:撩妹高手

是事件的使用被认为是糟糕,所有UI逻辑应通过命令使用MVVM模式的时候实施?

Is usage of events considered bad and all UI logic should be implemented via commands when using MVVM pattern?

推荐答案

这是值得我们思考什么MVVM模式真的给你。

It is worth thinking about what the MVVM pattern really gives you.

的关注分离 - (这是适用于所有用户界面模式) 的视图逻辑单元测试,通过执行视图模型不认为。 在开发,设计工作流程,允许使用混合工作,对同一code的设计师。

如果在code处理UI事件背后并不禁止以上,那么就没有问题!

If handling UI events in code behind doesn't prohibit the above, then there is no problem!

我个人使用的命令,如果我可以,但我不担心,如果有一点点code-背后必需的。

Personally I use commands if I can, but am not concerned if there is a little code-behind required.

 
精彩推荐
图片推荐