共用方式為


DataModel-View-ViewModel pattern series

I thought I should add a post with the full list of posts in the D-V-VM pattern. They are:

DataModel-View-ViewModel pattern: 1 (overview)

DataModel-View-ViewModel pattern: 2 (first implementation of DataModel class)

DM-V-VM part 3: A sample DataModel

DM-V-VM part 4: Unit testing the DataModel

DM-V-VM part 5: Commands

DM-V-VM part 6: Revisiting the data model

DM-V-VM part 7: Encapsulating commands

DM-V-VM part 8: View Models

Comments

  • Anonymous
    October 11, 2006
    Dan Crevier has series of posts on the DM-V-VM pattern, including how to implement it and how ot test

  • Anonymous
    October 12, 2006
    Thanks! Now you just need a DM-V-VM tag so that all your posts come up in one place. :)

  • Anonymous
    October 27, 2006
    Thanks this was great.   I specially liked the way you injected control into the StockModel [StockModel(symbol, IStockQuoteProvider)] To be honest, I had some difficulty grasbing the why & how of the ActivateModel.  I had to really think about it, but I think I get it now...with that said, would you please give an example of why you needed to do reference counting?  In other words: For which scenarios the ActiviateModel you described isn't good enough? Thanks again. Houman

  • Anonymous
    October 29, 2006
    I may have included one of those in one of my link roundups, but this is a topic very dear to my heart

  • Anonymous
    October 30, 2006
    One example scenario where I needed ref counting in the activation was in Max when we had nested views where the inner view's template was chosen programmatically based on the model state. Both the outer view and inner view needed to activate the model. If you don't need this, no need to add the complexity.

  • Anonymous
    October 31, 2006
    Thanks for a post, it is very good. Currently I am working on creating a back end accounting application with WPF. Since we anticipate many calls to service layer (WCF), I liked the concept of DataModel. It was curious that the constructor of the viewModel DataModel is doing actual data extraction. I would have thought you will have separate GetData Method. Usually I try to perform minimal task in constructors. I am also struggling about how to write an automated unit test for the PortfolioViewModel equivalent. To test the behavior of AddCommandModel and RemoveCommandModel etc. Any information you can provide in that domain can be helpful.

  • Anonymous
    October 31, 2006
    Actually the data extraction really happens when the model is activated. To unit test AddCommandModel/RemoveCommandModel, you can set up some test data in PortfolioViewModel. Then, you can get the commands through the PropertyViewModel accessors and call OnQueryEnabled and OnExecute with different parameters to try it out. In cases where you need to get to private methods and data, use PrivateObject or PrivateType.

  • Anonymous
    November 13, 2006
    I tried to use your suggestion to call OnQueryEnabled  and OnExecute  directly. I keep getting error "The type CanExecuteRoutedEventArgs has no constructors defined".  I am not able to find any sample which directly instantiates this class. My aim is to create a console application to test the behavior of presenter. I guess if I create a windows based application I can use command binding and test this via Command object. But not sure how to do this in Console app.

  • Anonymous
    November 13, 2006
    The comment has been removed

  • Anonymous
    December 18, 2006
    Regarding multiple parameters for the CommandModel: what if we set the ViewModel as the parameter for the CommandModel. This way the CommandModel can be the link between the ViewModel and the DataModel and can validate against N number of values.

  • Anonymous
    December 18, 2006
    Yes, that would definitely work. If you do things through an interface, it will keep the command from being specific to one view model.

  • Anonymous
    June 08, 2007
    I've been meaning to document how I wrapped the Twitter API ... in 4.5 seconds. There is a very powerful

  • Anonymous
    July 19, 2007
    I've been meaning to document how I wrapped the Twitter API ... in 4.5 seconds. There is a very powerful

  • Anonymous
    April 11, 2008
    Introduction I've been posting a lot about Silverlight lately, but hey, here is a WPF post, and about

  • Anonymous
    April 23, 2008
    Tonight I presented for the Dayton .Net Developers Group on WPF. Unlike my previous Lap Around WPF @

  • Anonymous
    April 29, 2008
    In this post (of what may become a series of posts if I find some interest from the community) I compare

  • Anonymous
    June 06, 2008
    First I'd like to say that I'm stoked about the work the Prism team has been doing.  I have

  • Anonymous
    June 29, 2008
    This post is based on an interpretation of a pattern called View-View Model-Document or View-View Model

  • Anonymous
    August 06, 2008
    Après avoir participé à quelques projets WPF depuis maintenant un peu plus d'un an, je suis dans une

  • Anonymous
    August 11, 2008
    Après avoir participé à quelques projets WPF depuis maintenant un peu plus d'un an, je suis dans une

  • Anonymous
    September 16, 2008
    Checking out DataModel ViewModel patterns.

  • Anonymous
    November 07, 2008
    Table of Contents Since my last post on building ChumChase, I've had a couple of projects that have

  • Anonymous
    November 07, 2008
    Table of Contents Since my last post on building ChumChase, I've had a couple of projects that have

  • Anonymous
    November 10, 2008
    Table of Contents Since my last post on building ChumChase, I've had a couple of projects that have

  • Anonymous
    December 15, 2008
    Serie Tutorial Pattern DM-V-VM

  • Anonymous
    February 05, 2009
    Вторая часть из серии постов, в которых мы последовательно пройдем все этапы соз

  • Anonymous
    February 15, 2009
    In this article I will explain how to implement MVVM pattern in Silverlight. I was very overjoyed when

  • Anonymous
    March 15, 2009
    #.think.in infoDose #21 (10th Mar - 15th Mar)

  • Anonymous
    April 27, 2009
    都是Silverlight做的游戏 http://www.silverarcade.com/Games