This project has moved and is read-only. For the latest updates, please go here.

Mvvm integration, days after project creation

Aug 30, 2013 at 1:51 AM
I want to integrate the Mvvm toolkit . Is this possible/recommended, days after I started working on my project?
I am following this tutorial here on how to integrate/use the toolkit. And from the sound of it, this has to be done only at the beginning of the project?
Aug 30, 2013 at 11:02 AM
It depends.

Is this an app that uses Prism heavily for example?
Is it a modular app or a standalone exe?
Are you already using another MVVM support framework or just using the design pattern and out of the box WPF stuff?

I can't see why not, you can change your viewmodels to use GalaSoft.MvvmLight.ViewModelBase, ICleanup etc, you can change to MVVM light relaycommand quite easily, use the messenger etc. You don't have to use MVVM Light's Simple IoC, if your already using another IoC for DI etc such as Unity,MEF, niNject you can continue to use them, we use Unity with MVVM Light. You can hand crank a viewmodellocator, add a bootstrapper if required and change your app.xaml & cs to change your app start-up (I'm assuming WPF).
Sep 1, 2013 at 5:05 PM
It's a windows phone app. Most of the work I've done on it were UI related. I attempted integrating the toolkit and no issues so far. Thanks a lot for the help!!
Sep 2, 2013 at 3:20 PM

Normally you should be able to integrate MVVM Light at any point in the project's lifetime. The templates are just there to help with the initial "wiring".

Sep 3, 2013 at 2:43 AM
Edited Sep 3, 2013 at 2:56 AM
Thanks for the clarification Ibugnion.
I am running into another issue.
I have resource files(of type .resx) that I have been trying to access through my MainPage.xaml . So I created an AppViewModelBase which is suppose to link to my color resx file, and English and French localization files. In such way (I'm not sure if this is the right way to do it though):
This is the AppViewModelBase class:
namespace dictio.ViewModel
    public class AppViewModelBase : ViewModelBase
        //Linking to Colors resource table
        private static AppRsrc_Colors rsrcClr = new AppRsrc_Colors();
        public AppRsrc_Colors Resources { get { return rsrcClr; } }

        //Linking to English resource table
        private static AppRsrc_ENG rsrcLgENG = new AppRsrc_ENG();
        public AppRsrc_ENG Resources { get { return rsrcLgENG; } }

        //Linking to French resource table
        private static AppRsrc_FRN rsrcLgFRN = new AppRsrc_FRN();
        public AppRsrc_FRN Resources { get { return rsrcLgFRN; } }
But now that there is already a datacontext linking to the ViewModelLocator class in my MainPage.xaml...
(based on the following code:)
    DataContext="{Binding Main, Source={StaticResource Locator}}"
... how am I suppose to reference the AppViewModelBase class for the MainPage.xaml file to access property values of the different resource files by data binding?
(Example of binding in MainPage.xaml for a color in color resource table)
<Setter Property="Background" Value="{Binding base_bg_clr}"/>
--Side note:--
Visual Studio didn't allow me to use another DataContext statement in MainPage.xaml .
Also I read I could just make a class inherit from the AppViewModelBase, but I can't figure out where to plug the inheritance now that I integrate the MVVM toolkit. Is it a good idea to make the ViewModelLocator class inherit from AppViewModelBase.