C# WPF - 打开、前进、后退页面操作

1、新建3个page页,分别命名为Page1.xaml、Page2.xaml、Page3.xaml;

2、修改App.xaml中StartupUri="Page1.xaml";

3、打开Page1页面代码如下:

NavigationService.Navigate(new Uri("Page1.xaml", UriKind.RelativeOrAbsolute));

4、前进

if (NavigationService.CanGoForward)
{
    NavigationService.GoForward();
}

5、后退

if (NavigationService.CanGoBack)
{
      NavigationService.GoBack();
}

 

  作者:Jeremy.Wu
  出处:https://www.cnblogs.com/jeremywucnblog/
  本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

posted @ 2020-04-09 14:29  Jeremy.Wu  阅读(1945)  评论(0编辑  收藏  举报