@ingamx: Hi and thanks! You should check MefedMVVM by Marlon Grech, he is using both MVVM (strongly inspired by MVVM Light) and MEF. I used MEF and MVVM Light in many projects, and I love it as a lightweight alternative to PRISM.
@Vitaliy: Hi, My preferred way of creating design time or test time data is to use a data service (for example IFriendsService in the video) and to inject different implementation depending on the scenario (design, test, runtime)). As you will see in the video, I use an IOC container to inject the service in the ViewModel. This is not compulsory, you can also create the VMs in the ViewModelLocator. This is a clean way to connect to your data.
There are great questions in here, and I will answer them all over the next couple of days.... but first I really need to sleep after that crazy trip Stay tuned.
@pippo: I need to give the session first The session is taking place on the 12th of April 2011. Videos are typically posted a couple of days after the event. Stay tuned!
Hey guys, thanks for the mention! Actually you'll be glad to know that someone is busy building an installer not just for the snippets of MVVM Light but for the whole toolkit. Looking forward to try it out and publish.
Small correction to Shawn's nice plug for the MVVM Light Toolkit: There are actually Project templates available, not "just" Item templates. . File, New Project, New MVVM Light. Available for VS08, VS10, Blend 3, Blend 4 and for SL3, SL4, WPF3.5, WPF4 and
WP7
Not sure what you mean with WF/SL code sharing. The MVVM Light Toolkit uses exactly the same syntax (and about 80% of the same code ) in WPF and in Silverlight. This is one of the strength of the framework actually. I am very careful to keep the code compatible.
This is a fairly simple way to create and bind your data context, but it has a few disadvantages that the Locator solves:
- You cannot pass parameters to the ViewModel constructor.
- You don't have control over the creation (and deletion) of the ViewModel. The parser will create it when the line in the resources is reached (in Silverlight... in WPF the ViewModel is created when it is used by a StaticResource extension). This makes
it impossible to create the ViewModel beforehand, for example when the application starts.
I hear you about the documentation. I am busy writing my next book now, so it won't be before a moment, but I have a series of posts titled MVVM Light 101 showing how to get started with each component. Great idea gathering them all in a single page. I am
also going to extract the XML documentation from the code to document the API in an easier way.
About your first question: Adding the MVVM Light to an application is actually very easy, and I am preparing a blog post showing how to do that. I will publish this ASAP. It is a matter of adding the DLL and then wiring up the objects together in XAML (or
in Blend...)
The main advantage of MVVM Light over Prism is that it is lighter and easier to add in an application. Also, it is very strongly aimed to Blendability, and all the components are created with this in mind. I generally recommend the following: If you have
an application using Prism already (for its composition features for example), then it might make more sense to use the Prism components for the MVVM application, in order to avoid adding too many dependencies. If you don't, I would rather recommend MVVM Light,
because it is lighter and easier.
Comments
Deep Dive MVVM
@Tolga42:Thanks for the kind words and the feedback. I will ping the CH9 team too.
Deep Dive MVVM
@ingamx: Hi and thanks!
You should check MefedMVVM by Marlon Grech, he is using both MVVM (strongly inspired by MVVM Light) and MEF. I used MEF and MVVM Light in many projects, and I love it as a lightweight alternative to PRISM.
Deep Dive MVVM
@Jedi: So happy to hear that. You guys give me such energy to continue this work. Thanks all.
Deep Dive MVVM
@Vitaliy: Hi, My preferred way of creating design time or test time data is to use a data service (for example IFriendsService in the video) and to inject different implementation depending on the scenario (design, test, runtime)). As you will see in the video, I use an IOC container to inject the service in the ViewModel. This is not compulsory, you can also create the VMs in the ViewModelLocator. This is a clean way to connect to your data.
Deep Dive MVVM
@Oscar Agreda: I am super happy you like it. I must admit, I have not had so much fun coding for years
Love that job, love the technology.
Deep Dive MVVM
Hey guys! Finally I am back in Switzerland, and can answer some comments here.
First off, the source code is available at http://blog.galasoft.ch/archive/2011/04/13/deep-dive-mvvm-samples-mix11-deepdivemvvm.aspx
Also, the MVVM Light code shown here is released as a preview at http://blog.galasoft.ch/archive/2011/04/14/mvvm-light-v4-preview-3-bl16-mix11-edition-mvvmlight.aspx
There are great questions in here, and I will answer them all over the next couple of days.... but first I really need to sleep after that crazy trip
Stay tuned.
Laurent
Deep Dive MVVM
@pippo: I need to give the session first
The session is taking place on the 12th of April 2011. Videos are typically posted a couple of days after the event. Stay tuned!
Cheers,
Laurent
TWC9: VS2010 SP1 Beta, Native Extensions for Silverlight, EF Code First
Hey guys, thanks for the mention! Actually you'll be glad to know that someone is busy building an installer not just for the snippets of MVVM Light but for the whole toolkit. Looking forward to try it out and publish.
Cheers,
Laurent
Silverlight TV 23: MVP Q&A with Wildermuth, Wahlin, and Bell
Small correction to Shawn's nice plug for the MVVM Light Toolkit: There are actually Project templates available, not "just" Item templates. . File, New Project, New MVVM Light. Available for VS08, VS10, Blend 3, Blend 4 and for SL3, SL4, WPF3.5, WPF4 and WP7
http://www.galasoft.ch/mvvm/getstarted
http://mvvmlight.codeplex.com/
Cheers,
Laurent
Silverlight TV 13: MVVM Light Toolkit
Hey John,
Not sure what you mean with WF/SL code sharing. The MVVM Light Toolkit uses exactly the same syntax (and about 80% of the same code
) in WPF and in Silverlight. This is one of the strength of the framework actually. I am very careful to keep the code compatible.
Cheers,
Laurent
Silverlight TV 13: MVVM Light Toolkit
Hi Ali,
In your sample, you declared the MainViewModel as a resource. Hence, you must bind to the resource, using the StaticResource extension.
<Grid DataContext="{Binding Source={StaticResource MainPageViewModel}}">
This is a fairly simple way to create and bind your data context, but it has a few disadvantages that the Locator solves:
- You cannot pass parameters to the ViewModel constructor.
- You don't have control over the creation (and deletion) of the ViewModel. The parser will create it when the line in the resources is reached (in Silverlight... in WPF the ViewModel is created when it is used by a StaticResource extension). This makes it impossible to create the ViewModel beforehand, for example when the application starts.
I hear you about the documentation. I am busy writing my next book now, so it won't be before a moment, but I have a series of posts titled MVVM Light 101 showing how to get started with each component. Great idea gathering them all in a single page. I am also going to extract the XML documentation from the code to document the API in an easier way.
Thanks
Laurent
Silverlight TV 13: MVVM Light Toolkit
Hi Ben, and thanks!
About your first question: Adding the MVVM Light to an application is actually very easy, and I am preparing a blog post showing how to do that. I will publish this ASAP. It is a matter of adding the DLL and then wiring up the objects together in XAML (or in Blend...)
The main advantage of MVVM Light over Prism is that it is lighter and easier to add in an application. Also, it is very strongly aimed to Blendability, and all the components are created with this in mind. I generally recommend the following: If you have an application using Prism already (for its composition features for example), then it might make more sense to use the Prism components for the MVVM application, in order to avoid adding too many dependencies. If you don't, I would rather recommend MVVM Light, because it is lighter and easier.
Hope this helps!
Laurent