Restrict Back navigation in Pivot

拥有回忆 提交于 2019-12-04 22:09:28

First, I agree with Gambit's comment that this is non-standard behavior and generally goes against a user's reasonable expectation of UI behavior. I would caution against it without a compelling reason.

That said, you can stop the looping on the pivot in the SelectionChanged event using the AddedItems and RemovedItems collections.

private void Pivot_SelectionChanged( object sender, SelectionChangedEventArgs e ) {
    if( e.AddedItems[0].Equals( PivotItem1 ) && e.RemovedItems[0].Equals( PivotItem8 ) ) {
        Pivot.SelectedIndex = 0;
    } else if( e.RemovedItems[0].Equals( PivotItem8 ) ) {
        NavigationService.Navigate( new Uri( "/NextPage.xaml", UriKind.Relative ) );
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!