在没有MVVM的情况下开发WPF软件 [英] Developing WPF software without MVVM

查看:113
本文介绍了在没有MVVM的情况下开发WPF软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要开始开发中间桌面软件. 我们决定使用WPF. 我们不想使用MVVM模式. 因为我们不熟悉MVVM,并且也有时间限制. 在没有MVVM模式的情况下开发WPF应用程序是否正确(使用三层体系结构但没有MVVM) 尽管它比胜出形式有更好的表现吗?

We want to start develop an intermediate desktop software. We decided to use the WPF. We don't want to use the MVVM pattern. Because we are not familiar with MVVM, and also have time limits. Is it true to develop WPF application without MVVM pattern (using 3 layer architecture but without MVVM) Although does it have better performance than win forms yet ?

推荐答案

使用wpf时不需要依赖MVVM.真正正确使用wpf的关键是:

You don't need to rely on MVVM when using wpf. Really the keys to using wpf properly are:

  • 使用命令而不是事件(您可能会在未意识到的情况下执行此操作,但请务必确认)
  • 使用数据绑定,而不是直接从控件中获取值
  • 设置数据上下文并绑定到该上下文,而不是绑定到后面的代码

MVVM在这两件事上确实非常有效,但不是必需的.具体地说,MVVM需要三层严格的关注点分离,而使用MVP可以轻松实现.

MVVM works really well for these two things but is not required. Specifically, MVVM requires a 3-tier strict separation of concerns that can just as easily be done with MVP.

就性能而言,这实际上取决于运行应用程序的平台和编码风格.如果您在没有像样的图形卡的计算机上运行它,则winForms的性能可能会更好,因为wpf可能会恢复为非常慢的软件渲染.如果您需要做3D图形,那么wpf实际上是您唯一的选择.

As far as performance is concerned, that really depends on the platform on which the app is run and the coding style. If you run it on a computer without a decent graphics card then winForms will probably perform better because wpf will probably revert to software rendering which will be very slow. If you need to do 3d graphics then wpf is really your only option.

有人建议不要使用MVVM .

如何使用wpf进行MVP的代码项目示例

这篇关于在没有MVVM的情况下开发WPF软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆