Silverlight + Model-View-ViewModel (MVVM)

     早在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 appsJohn Gossman 2005年写的一篇关于Model-View-ViewModel模式的博文
StackOverflow 讨论 Should I use the Model-View-ViewModel (MVVM) pattern in Silverlight projects?
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 series8篇介绍WPF的 sample DataModelViewModel
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/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值