private void GoBack() { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { _messenger.Register <CloseDashboard>(this, _ => DashboardPopup.Hide()); _messenger.Register <NavigatedToOperation>(this, msg => { switch (msg.NavigationMode) { case NavigationMode.New: if (msg.Operation == null) { ContentFrame.Navigate(typeof(ApiInfoPage), SessionManagerVM.CurrentDocument); } else { ContentFrame.Navigate(typeof(SwaggerOperationPage), msg.Operation); } break; case NavigationMode.Back: ContentFrame.GoBack(); break; case NavigationMode.Forward: ContentFrame.GoForward(); break; } OperationsListView.SelectedItem = msg.Operation; }); KeyDown += OnKeyDown; SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; }
private void nvSample_BackRequested(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack == true) { ContentFrame.GoBack(); } }
private void BackBtn_OnClick(object sender, RoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void _HamburgerView_BackButtonClick(object sender, RoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(new SuppressNavigationTransitionInfo()); } }
void HBPervious_Click(object sender, RoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void NavView_OnBackRequested(Windows.UI.Xaml.Controls.NavigationView sender, NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
/// <summary> /// Handles the Navigation Request /// </summary> /// <param name="message">The Navigation goback request</param> public virtual void Handle(GoBackNavigationRequest message) { // Check, if we can go back if (!CanGoBack) { return; } #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed // Now Go Back if (CurrentPage.Dispatcher.HasThreadAccess) { // When going back, delete an potential error and clear the state if (CurrentPage.DataContext is ViewModelBase baseModel && baseModel.IsDefective) { baseModel.Error = string.Empty; } if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } } else { CurrentPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => Handle(message)); } #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }
private void BackButton_Click(object sender, RoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); if (ContentFrame.SourcePageType == typeof(HomePage)) { HomeNav.IsChecked = true; } else if (ContentFrame.SourcePageType == typeof(CarsPage)) { CarsNav.IsChecked = true; } else if (ContentFrame.SourcePageType == typeof(DevicesPage)) { DevicesNav.IsChecked = true; } else if (ContentFrame.SourcePageType == typeof(ProfilePage)) { ProfileNav.IsChecked = true; } else if (ContentFrame.SourcePageType == typeof(SettingsPage)) { SettingsNav.IsChecked = true; } } }
private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) { // 本函数处理左侧导航栏点击事件 // 寻找点击的Item var item = sender.MenuItems.OfType <NavigationViewItem>().First(x => (string)x.Content == (string)args.InvokedItem); NavView_Navigate(item as NavigationViewItem); // 处理右侧Frame跳转逻辑 if (ContentFrame.CurrentSourcePageType != typeof(NavigatorPage)) { if (ContentFrame.CurrentSourcePageType != typeof(NewPage) || !ContentFrame.CanGoBack) { ContentFrame.Navigate(typeof(NavigatorPage)); } else { ContentFrame.GoBack(); } } else if (ContentFrame.Visibility == Visibility.Visible) { ContentFrame.Visibility = Visibility.Collapsed; } else { ContentFrame.Visibility = Visibility.Visible; } }
private void ContentFrame_OnNavigationFailed(object sender, NavigationFailedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void MainPage_BackRequested(object sender, BackRequestedEventArgs e) { if (!ContentFrame.CanGoBack) { e.Handled = true; } else { ContentFrame.GoBack(); if (ContentFrame.SourcePageType == typeof(SettingsPage)) { NavView.SelectedItem = NavView.SettingsItem as NavigationViewItem; } else { Dictionary <Type, string> lookup = new Dictionary <Type, string>() { { typeof(AccountPage), "account" }, { typeof(DashboardPage), "dashboard" } }; String stringTag = lookup[ContentFrame.SourcePageType]; foreach (NavigationViewItemBase item in NavView.MenuItems) { if (item is NavigationViewItem && item.Tag.Equals(stringTag)) { item.IsSelected = true; break; } } } } }
private void NavigationView_OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack) { ViewModel.SelectedItem = null; ContentFrame.GoBack(new SuppressNavigationTransitionInfo()); // Reset selected item when showing browsing views. if (ContentFrame.Content is OfflineMapsView) { NavigationView.SelectedItem = LocalContentMenuItem; } if (ContentFrame.Content is PortalBrowserView) { NavigationView.SelectedItem = MyFoldersMenuItem; } if (ContentFrame.Content is PortalGroupView) { NavigationView.SelectedItem = MyGroupsMenuItem; } if (ContentFrame.Content is SearchPage) { NavigationView.SelectedItem = SearchMenuItem; } } ContentFrame.BackStack.Clear(); }
private void NavView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void BackwardButton1_Click(object sender, RoutedEventArgs e) { if (ContentFrame.BackStackDepth > 0) { ContentFrame.GoBack(); } }
private void Back_Click(object sender, RoutedEventArgs e) { if (!(ContentFrame.Content is ChatPage)) { ContentFrame.GoBack(); } }
private void NavigateBackward(object sender, RoutedEventArgs e) { if (ContentFrame.BackStackDepth() > 0) { ContentFrame.GoBack(); } }
private void backButton_Tapped(object sender, TappedRoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); Main.IsSelected = true; } }
private void backbtn_Click(object sender, RoutedEventArgs e) { forwardbtn.Visibility = Visibility.Visible; if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void ContentFrameBackToShell() { // 退到最上层 while (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } }
private void On_BackRequested(object sender, BackRequestedEventArgs e) { if (!e.Handled && ContentFrame.CanGoBack) { ContentFrame.GoBack(); e.Handled = true; } }
private void OnBackRequested(object sender, BackRequestedEventArgs e) { if (ContentFrame.CanGoBack) { e.Handled = true; ContentFrame.GoBack(); } }
private void NavView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { ContentFrame.GoBack(); ContentFrame.ContentRendered += delegate { var pageType = ContentFrame.Content.GetType(); NavView.Header = App.LocalizedStrings.Where(x => x.Key == pageType.Name + "Header")?.FirstOrDefault().Value; }; }
public void GoBack(object parameter = null) { if (ContentFrame.BackStack.Count > 0) { ContentFrame.GoBack(); } ViewModel.LoadProfiles(); }
private void BackRequested(object sender, BackRequestedEventArgs e) { //Frame rootFrame = Window.Current.Content as Frame; //if (rootFrame == null) // return; //if (rootFrame.CanGoBack && e.Handled == false) //{ // e.Handled = true; //} if (needtwoback) { ContentFrame.GoBack(); if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } needtwoback = false; } else { ContentFrame.GoBack(); } var currentFrame_back = (ContentFrame as Frame).CurrentSourcePageType.Name; switch (currentFrame_back) { case "Main": Main.IsSelected = true; needtwoback = true; break; case "Camera": Camera.IsSelected = true; needtwoback = true; break; case "edit": EditPhoto.IsSelected = true; needtwoback = true; break; case "favorite": Collection.IsSelected = true; needtwoback = true; break; case "join": Puzzle.IsSelected = true; needtwoback = true; break; case "set": break; } }
private void GoBack_Click(object sender, RoutedEventArgs e) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } GoBack.IsChecked = false; }
private bool On_BackRequested() { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); return(true); } return(false); }
private void NavigationView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack) { var context = DataContext as HomeViewModel; context.FakeGoBack.Execute(); // MY BUG! not every time this works & I have now idea why ContentFrame.GoBack(); } }
public bool TryGoBack() { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); return(true); } return(false); }
private void TopLevelNav_OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { if (ContentFrame.CanGoBack) { ContentFrame.GoBack(); } TopLevelNav.SelectedItem = ContentFrame.Content is SettingsPage ? null : TopLevelNav.MenuItems[0]; TopLevelNav.IsBackEnabled = ContentFrame.CanGoBack; }