Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

Try this

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

It will work.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top