public void GoBack() { if (CurrentItem != null) { ForwardStack.Push(CurrentItem); } if (BackStack.Count > 0) { CurrentItem = BackStack.Pop(); } OnStackChanged(); }
private async void BtnBack_Click(object sender, RoutedEventArgs e) { var item = BackStack.Pop(); if (BackStack.Count == 0) { IsbtnBackEnabled = false; } ForwardStack.Push(LastSearch); IsbtnForwardEnabled = true; tbID.Text = item; await StartFinding(); }
private void HandleContentNavigating(object sender, NavigatingCancelEventArgs e) { if (IsNavigating) { return; } IsNavigating = true; // Choose the name of the transition based on the e.ExtraData that was passed to NavigationService.Navigate(). // If the data is a string, we'll try to find a matching transition by that name. if (e.ExtraData is ResolvedNavigationRequest) { var transitionName = ((ResolvedNavigationRequest)e.ExtraData).RouteValues.GetOrDefault <string>("Transition"); CurrentTransition = transitionRegistry.Get(transitionName); } else if (e.ExtraData is string && transitionRegistry.Get(e.ExtraData.ToString()) != null) { var transitionName = e.ExtraData.ToString(); CurrentTransition = transitionRegistry.Get(transitionName); } else { CurrentTransition = null; } // Keep a record of back/forward navigation and use this to select the reverse transitions. if (e.NavigationMode == NavigationMode.New) { BackStack.Push(CurrentTransition); } else if (e.NavigationMode == NavigationMode.Back) { var original = BackStack.Pop(); ForwardStack.Push(original); var reverseTransition = original == null ? null : transitionRegistry.Get(original.Reverse); CurrentTransition = reverseTransition; } else if (e.NavigationMode == NavigationMode.Forward) { CurrentTransition = ForwardStack.Pop(); BackStack.Push(CurrentTransition); } }