您的位置:首页 > 其它

[WPF] MVVM的一点资源

2010-06-14 14:55 225 查看
1. Josh Smith发表在MSDN Maginze上的那篇《WPF Apps With The Model-View-ViewModel Design Pattern》,Link: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

John Gossman的《Introduction to Model/View/ViewModel pattern for building WPF apps》, Link: http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx

2. MVVM的本质是将UI跟后台的Logic彻底剥离,通过Binding来实现两者关联。然而,WPF现有的Functionality并不能满足这个需求。一个简单的例子是,在TreeView上实现双击(MouseDoubleClicked)事件,这个Event不能通过简单的Command进行binding。这就需要额外的工作,比如Attached Behavior:

Josh Smith在CodeProject上Article《Introduction to Attached Behaviors in WPF》,Link: http://www.codeproject.com/KB/WPF/AttachedBehaviors.aspx

偶个人推荐的一个很好的资源:Marlon Grech的AttachedCommandBehavior V2: http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/

同样来自Markon Grech, 几个有用的Tips:

ListBox的多选模式的Binding: http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/

使用ACB得到EventArgs: http://marlongrech.wordpress.com/2009/07/03/how-to-get-the-eventargs-as-a-commandparameter-using-the-attachedcommandbehaviour/

3. 另外一些成熟的封装库:

Sacha Barber的<Cinch>, Link: http://www.codeproject.com/KB/WPF/Cinch.aspx

Mark Smith (Julmar Technology)的<MVVM Helper Library>, Link: http://mvvmhelpers.codeplex.com/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: