Question

I have to write a library. That library contains his own xaml view. Now, the user can call the method "startLibrary(NavigationService service)". This method contains no PhoneApplicationPage. Thats the reason why i have the parameter NavigationSerivce.

Now, i want to navigate to my library view:

service.Navigate(new Uri("/SurveyView.xaml"));

But i always get the error "Invalid URI: The format of the URI could not be determined."

It's important to say that only the library can navigate to the view, not the APP!

What is the right way to do that?

Était-ce utile?

La solution

You usually navigate using the following syntax:

NavigationService.Navigate(new Uri("/page.xaml", UriKind.Relative));

If a page is in another assembly, use the following syntax

NavigationService.Navigate(new Uri("/AssemblyName;component/page.xaml", UriKind.Relative));

Autres conseils

Try this

((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(new Uri("/SurveyView.xaml", UriKind.Relative));

It will work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top