I have a problem with navigationService and navigationService.Configure
In my ViewModelLocator constructor I have:
var navigationService = new NavigationService();
navigationService.Configure("MvvmView",new Uri("/MvvmView1.xaml"));
navigationService.Configure("Main",new Uri("/MainPage.xaml"));
SimpleIoc.Default.Register<INavigationService>(() => navigationService);
MvvmView1.xaml is in my main folder, the same as MainPage.xaml.
What is strange - it returns me an error
{System.TypeInitializationException: The type initializer for 'SpaceQuiz.ViewModel.ViewModelLocator' threw an exception. ---> System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString) at SpaceQuiz.ViewModel.ViewModelLocator..cctor() --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at MS.Internal.TypeProxy.<>c__DisplayClass32.b__2c() at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId) at MS.Internal.XamlManagedRuntimeRPInvokes.CreateInstance(XamlTypeToken inXamlType, XamlQualifiedObject& newObject)}
I tried a lot of combinations, like:
navigationService.Configure("MvvmView",new Uri("MvvmView1.xaml"));
navigationService.Configure("MvvmView",new Uri("/MvvmView1"));
navigationService.Configure("MvvmView",new Uri("MvvmView1"));
navigationService.Configure("MvvmView",new Uri("./MvvmView1.xaml"));
navigationService.Configure("MvvmView",new Uri("/MvvmView"));
etc - without any success..
How to register navigation in mvvm light?
Any help would be valuable.
Regards