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?

Was it helpful?

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));

OTHER TIPS

Try this

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

It will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top