下面我们来看Page1.xaml















<Hyperlink NavigateUri="page2.xaml">page 2</Hyperlink>
等价于以下后台代码:
NavigationService.GetNavigationService(this).Navigate(new Uri("page2.xaml", UriKind.Relative));
其中,NavigationService是一个提供静态导航方法的类,还有两个方法负责后退和前进:
NavigationService.GetNavigationService(this).GoForward();
NavigationService.GetNavigationService(this).GoBack();
可以放在按钮事件中完成导航。
配套源码的例子是可以用的(WpfPreReleaseBookSamples\ch01\beta2\MyNavApp)。