我在wpf上使用功能区,并且当我切换选项卡时,我使用SelectionChanged属性并导航到另一个页面。在我使用导航后退按钮之前,一切正常,
下面的代码在第2页和第3页上复制。
private void Ribbon_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var _currentSelection = Ribbon.SelectedIndex;
if(_currentSelection != 0)
{
switch(_currentSelection)
{
case 0:
NavigationService One = NavigationService.GetNavigationService(this);
One.Navigate(new Uri("Pages/One.xaml", UriKind.Relative));
break;
case 1:
NavigationService Two = NavigationService.GetNavigationService(this);
Two.Navigate(new Uri("Pages/Two.xaml", UriKind.Relative));
break;
case 2:
NavigationService Three = NavigationService.GetNavigationService(this);
Three.Navigate(new Uri("Pages/Three.xaml", UriKind.Relative));
break;
default:
break;
}
}
}
如何在不使程序崩溃的情况下导航回上一页?
有没有可行的解决方案?