Nvigation Windows Phone Apps

121 views Asked by At

I want to navigate from one page to an another for my windows phone app, but the problem is that if I use this type of code:

private void hyperlinkButton1_Click(object sender, RoutedEventArgs e) 
{ 
   NavigationService.Navigate(new Uri("/SecondPage.xaml", UriKind.Relative)); 
}

The debugger says that NavigationService is not available in the context

What should I do?

2

There are 2 answers

0
Abbas Galiyakotwala On

NavigationService does not exist because it is only used in Windows Phone Silverlight apps.

Use Frame.Navigate():

Frame.Navigate(new Uri("/SecondPage.xaml", UriKind.Relative));
0
Krunal Mevada On

If your use project template Windows Phone 8.0 OR Windows phone 8.0(Sliverlight)

then try to below one :

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

And if your are using Windows phone 8.1 then :

Frame.Navigate(typeof(SecondPage));

OR

Frame.Navigate(typeof(SecondPage), param);