I am using MVVM Light V4 with Ninject. My ViewModel files are in a separate assembly. It works great when ViewModelLocator is at the beginning of the build (view files). Shift works.
I want to place the ViewModelLocator in the ViewModel assembly, but when I do this, I lose compatibility. After that, it only works correctly in a running application (not in development time mode).
ViewModelLocator:
static ViewModelLocator() { ServiceLocator.Initialize(); if (ViewModelBase.IsInDesignModeStatic) { using (var module = new DesignBindingsModule()) { ServiceLocator.Load(module); } } else { using (var module = new DefaultBindingsModule()) { ServiceLocator.Load(module); } } } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This non-static member is needed for data binding purposes.")] public IMainWindowViewModel MainWindow { get { return ServiceLocator.Get<IMainWindowViewModel>(); } }
Is it possible to put ViewModelLocator in a separate assembly and bind to it in development time mode?
source share