using Cimbalino.Toolkit.Services;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
namespace App1.ViewModel
{
public class ViewModelLocator
{
public MainViewModel Main { get { return ServiceLocator.Current.GetInstance<MainViewModel>(); } }
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
SimpleIoc.Default.Register<INavigationService, NavigationService>();
SimpleIoc.Default.Register<MainViewModel>();
}
}
}
ViewModel
using Cimbalino.Toolkit.Services;
using GalaSoft.MvvmLight;
namespace App1.ViewModel
{
public class MainViewModel : ViewModelBase
{
public MainViewModel(INavigationService navigationService)
{
}
}
}
Error when building the first time/after reopening the xaml
Error 1 The method or operation is not implemented. c:\users\name\documents\visual studio 2013\Projects\App1\App1\MainPage.xaml 10 5 App1
Error when rebuilding
Error 1 Could not find Windows Runtime type 'Windows.UI.Xaml.TickBar'. c:\users\name\documents\visual studio 2013\Projects\App1\App1\MainPage.xaml 10 5 App1
No error if INavigationService is removed from the ViewModel's constructor.
ViewModelLocator
ViewModel
Page
Error when building the first time/after reopening the xaml
Error when rebuilding
No error if INavigationService is removed from the ViewModel's constructor.