0

I'm trying to implement simple code, that allows user to go to another app-page with transferring parameter/variable "Totall" to next page:

 Private Sub HyperlinkButton_Click(sender As Object, e As RoutedEventArgs)
        NavigationService.Navigate(New Uri("/Mainpage.xaml?totall=" & Totall, UriKind.Relative))

        Me.Frame.Navigate(GetType(MainPage))
    End Sub

But I get an error "NavigationService is not declared". Why is happening? This is WP8.1 app on Framework 4.5 This is not a Silverlight app. Yes, I have declared Imports Windows.UI.Xaml.Navigation Thank you!

Artur Tychina
  • 105
  • 2
  • 8

1 Answers1

0

NavigationService is not available in WinRT. To pass parameters while navigating, you can use the second line in your method and just add the parameter:

Me.Frame.Navigate(GetType(MainPage), Totall)

To retrieve this parameter on the target page, override the OnNavigatedTo method like in the following example:

Protected Overrides Sub OnNavigatedTo(ByVal e As NavigationEventArgs)
    total1 = e.Parameter as Integer
End Sub

If you want to use NavigationService, you'd need to switch to a Windows Phone Silverlight app...

andreask
  • 4,248
  • 1
  • 20
  • 25