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?

有帮助吗?

解决方案

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

其他提示

Try this

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

It will work.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top