/* In App.xaml: In the View: DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}" */ using CommonServiceLocator; using GalaSoft.MvvmLight.Ioc; namespace NandReaderGui.ViewModel { /// /// This class contains static references to all the view models in the /// application and provides an entry point for the bindings. /// /// See http://www.mvvmlight.net /// /// public class ViewModelLocator { static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); SimpleIoc.Default.Register(); } /// /// Gets the Main property. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This non-static member is needed for data binding purposes.")] public NandViewModel Main => ServiceLocator.Current.GetInstance(); /// /// Cleans up all the resources. /// public static void Cleanup() { } } }