限制后退导航枢轴 [英] Restrict Back navigation in Pivot
问题描述
我已经创建了一个包含8枢轴items.And我不希望我的第一个项目透视导航向后平均值,而当它到达第8个页面就应该导航到其他一些page.And也可以写我自己的一个支点页功能枢轴页刷卡事件。
首先,我开局的评论认为,这是不规范的行为和一般无二针对UI行为用户的合理期望。我奉劝不要它没有一个令人信服的理由。
这是说,你可以停止在的SelectionChanged $ C $支点的循环C>使用
AddedItems
和 RemovedItems
系列。
<事件pre>
私人无效Pivot_SelectionChanged(对象发件人,SelectionChangedEventArgs E){
如果(e.AddedItems [0] .Equals(PivotItem1)及和放大器; e.RemovedItems [0] .Equals (PivotItem8)){
Pivot.SelectedIndex = 0;
}否则如果(e.RemovedItems [0] .Equals(PivotItem8)){
NavigationService.Navigate(新的URI(/NextPage.xaml,UriKind.Relative));
}
}
I have Created a Pivot Page containing 8 Pivot items.And I Dont want my first Pivot Item to navigate backwards Mean while when it reaches the eigth page it should navigate to some other page.And also is it possible to write my own function for swipe event in pivot page.
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 ) );
}
}
这篇关于限制后退导航枢轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!