locked
Sample projects for MVVM Light RRS feed

  • Question

  • Hi,

    I've created a project in VS 2012 with MVVM Light(4.5) template.  It comes with few classes and folders.  I was wondering if there are any sample codes or examples on how to customise it for basic needs.

    I am struggling to understand ViewModelLocator class, ServiceLocator and SimpleIoc.  I've searched online and understand that the locator is a singleton instance for an entire application and a repository for all viewModels. 

    I don't understand do I need to create properties in this class for each viewModel or how does it work ?  Are there any simple but real word examples  - I am just failing to grasp the basics of MVVM Light and it's template.

    thanks

    Friday, June 14, 2013 3:03 PM

Answers

All replies

  • Or how about using Simple MVVM, which comes with documentation and sample examples too ?

    Friday, June 14, 2013 3:21 PM
  • Hi Alex,

    There are some detailed tutorial about MVVM Light you can refer to:

    http://www.youtube.com/watch?v=s-goeb2u3oA

    http://www.canofcode.co.uk/software/understanding-mvvm-mvvm-light/

    http://wpf4developers.blogspot.in/2012/01/model-view-viewmodel.html

    http://www.geekchamp.com/news/understanding-mvvm-a-series-of-mvvm-light-toolkit-tutorials

    Regards,


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Alex Teslin Tuesday, June 18, 2013 8:38 PM
    Tuesday, June 18, 2013 11:42 AM
  • Thank you for your post.

    They look very helpful.  I think as a beginner to not only the toolkit but to MVVM and wpf itself, I am going through this example by Josh Smith:

    http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

    Although it might be little out of date it shows exactly what I want to achieve.  Once I am comfortable with it I can then use the latest MVVM Light toolkit to make the necessary changes.  And comeback here with more specific questions.

    Thank you

    Tuesday, June 18, 2013 8:38 PM
  • Hi Alex,

    Do you have the code example (downloaded) from this article by Josh Smith?

    http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

    FYI, the download link is not working on this article. So, if you have it I would love to get it.

    Thanks!

    Friday, May 30, 2014 4:14 PM
  • Hi Chiragbhagat,

    Apologies for not responding earlier.  I have found it on my machine, but I don't know how to upload here.  I can't see any button/link to do that.  Not sure what would be the best way to do that, hopefully some can suggest how can I upload.

    Wednesday, July 9, 2014 1:21 PM
  • Greentings all, I have a copy of that sample mvvm project and have recreated it (without the Unit Tests).  You can download the zip file (which I named myDemoApp.zip)  here 

    -- I named the app itself DemoApp

    It would be great if someone could convert this sample project to mvvmLight.  I too am having some difficulties wrapping my brains around the ViewModelLocator class.


    Rich P

    Thursday, July 17, 2014 9:04 PM
  • Create a new mvvm light project.

    Search all on mainviewmodel.

    Look at the code where it is used.

    Pretty much just copy those bits for any new viewmodel.

    Your new view should then set it's datacontext using your new static supplying it's corresponding viewmodel.

    Closer?


    • Edited by Andy ONeill Thursday, July 17, 2014 9:33 PM
    Thursday, July 17, 2014 9:32 PM