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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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 ) );
}
}