Silverlight + Model-View-ViewModel (MVVM)

Silverlight + Model-View-ViewModel (MVVM),第1张

概述     早在2005年,John Gossman写了一篇关于Model-View-ViewModel模式的博文,这种模式被他所在的微软的项目组用来创建Expression Blend(即'Sparkle')。它跟Martin Fowler的Presentation Model非常相似,唯一不同的是,它填平了presentation model和使用了WPF的丰富的数据绑定的view之间的沟壑。在

     早在2005年,John Gossman写了一篇关于Model-VIEw-viewmodel模式的博文,这种模式被他所在的微软的项目组用来创建Expression Blend(即'sparkle')。它跟Martin Fowler的Presentation Model非常相似,唯一不同的是,它填平了presentation model和使用了WPF的丰富的数据绑定的vIEw之间的沟壑。在Dan CrevIEr发表了神作DataModel-VIEw-viewmodel serIEs博文系列之后,(D)MVVM模式开始变得流行起来。

     (Data)Model-VIEw-viewmodel模式跟经典的Model-VIEw-Presenter模式很相似,除了你需要一个为VIEw量身定制的model,这个model就是viewmodel。viewmodel包含所有由UI特定的接口和属性,它们是轻松构建UI的必要元素。VIEw绑定到viewmodel,然后执行一些命令在向它请求一个动作。而反过来,viewmodel跟Model通讯,告诉它更新来响应UI。

      这使得为应用构建UI非常的容易。往一个应用程序上贴一个界面越容易,外观设计师就越容易使用Blend来创建一个漂亮的界面。同时,当UI和功能越来越松耦合的时候,功能的可测试性就越来越强。

John Gossman's Introduction to Model/View/ViewModel pattern for building WPF apps John Gossman 2005年写的一篇关于Model-VIEw-viewmodel模式的博文
StackOverflow 讨论 Should I use the Model-View-ViewModel (MVVM) pattern in Silverlight projects? Jonas Follesø's YouCard exampleNikhil Kothari's ViewModel Pattern in Silverlight and a funky extension to MVVM using the DLRMartin Fowler's Presentation Model
WPF 应用程序使用程序的模型视图 ViewModel 设计模式

为什么 WPF 开发人员喜欢 MVVM

一旦开发人员成为熟悉 WPF 和 MVVM,很难区分这两者。 MVVM 是 WPF 开发人员的语言 franca,因为它是适合在 WPF 平台 WPF 为了方便地构建应用程序使用 MVVM 模式 (在其他)。 实际上,Microsoft 使用 MVVM 内部开发 WPF 应用程序,Microsoft Expression Blend,如,核心 WPF 平台时正在建设中。 WPF,如外观不控制模型和数据模板的许多方面使用显示的状态和行为的 MVVM 提升强的分离。

Dan Crevier's DataModel-View-ViewModel pattern series 8篇介绍WPF的 sample DataModel 和 ViewModel
David Wynn's Silverlight and the View-ViewModel Pattern 使用 NInject,Silverlight Extensions (Command) 和Unit Testing的例子
Josh Smith讨论MVVM eliminates 99% of the need for ValueConverters
The only place I can see a use for value converters in an MVVM architecture is cross-element bindings. If I'm binding the Visibility of a panel to the IsChecked of a CheckBox,then I will need to use the BooleanToVisibilityConverter.
Mark Heath's Model View View-Model (MVVM) in Silverlight 在Silverlight 2.0演示MVVM 的例子


相关文章:
Hands-On Model-VIEw-viewmodel (MVVM) for Silverlight and WPF :
 http://weblogs.asp.net/craigshoemaker/archive/2009/02/26/hands-on-model-view-viewmodel-mvvm-for-silverlight-and-wpf.aspx
MVVM pattern in Silverlight using SLEextensions
http://blog.developers.ba/post/2009/02/15/MVVM-pattern-in-Silverlight-using-SLEextensions.aspx
[WPF] Another sample of WPF application using the pattern MVVM
http://weblogs.asp.net/thomaslebrun/archive/2009/03/17/wpf-another-sample-of-wpf-application-using-the-pattern-mvvm.aspx

浅谈MVP与Model-View-ViewModel(MVVM)设计模式

http://mvvmref.codeplex.com/

总结

以上是内存溢出为你收集整理的Silverlight + Model-View-ViewModel (MVVM)全部内容,希望文章能够帮你解决Silverlight + Model-View-ViewModel (MVVM)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1061872.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存