Page navigation WP8.1

2019-02-27 04:33发布

I made an app to WP8 and I used the page navigation like NavigationService.Navigate(new Uri(...)) and worked well.
But now I'm trying to develop a WP8.1 app and can't figure out how is it going.
I get the following error The name 'NavigationService' does not exist in the current context.
I have two pages and I want to navigate between them.
How can I do?
What changed?

2条回答
疯言疯语
2楼-- · 2019-02-27 04:59

You can navigate using

Frame.Navigate(typeof(MainPage));

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-02-27 05:07

For Universal Apps (Windows Runtime), you need to use the Frame.Navigate(...) overload, with the type of the page you're navigating to.

To navigate to MainPage.xaml, you can use Frame.Navigate(typeof(MainPage));

I'll recommend reading Quickstart: Navigating between pages (Windows Runtime apps using C#/VB/C++ and XAML) (MSDN)

查看更多
登录 后发表回答