WinRt page navigation

我是研究僧i 提交于 2019-12-06 04:12:37

The code you tried doesn't work because is not the main frame, you should publish the MainFrame reference to the rest of your code so that you can navigate outside views code behind. If you are making something simple I recommend putting a static property on the App class publishing the main frame instance.

EDIT: Some code

On App.xaml.cs
      public static Frame MainFrame{get;private set;}

      protected override void OnLaunched(LaunchActivatedEventArgs args)
            {
                Frame rootFrame = Window.Current.Content as Frame;
                MainFrame = rootFrame;
(....)
            }
Usage:
       App.MainFrame.Navigate(...);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!