public void OnNavigated(PageIndex pageIndex, bool isFailedBackNav) { var stackIdentifier = pageIndex.GetAssociatedStack(); var stackCount = _stacks[stackIdentifier].Count; var message = new NavigationStackUpdateMessage { NavigationStack = stackIdentifier, CanGoBack = stackCount > 0, NavigatedBackToEmpty = stackCount <= 0 && isFailedBackNav }; Messenger.Default.Send(message); }
private void OnNavigationStackUpdateMessage(NavigationStackUpdateMessage message) { if (message.NavigationStack == NavigationStack.OffStack) { if (message.NavigatedBackToEmpty) { OffFrame.Visibility = Visibility.Collapsed; _offFrameWidthWhenLastHidden = OffFrameGridColumn.Width.Value; OffFrameGridColumn.Width = new GridLength(0); App.NavigationManager.Reset(PageIndex.OffStackIdentifier); } else { if (OffFrame.Visibility == Visibility.Collapsed) { OffFrame.Visibility = Visibility.Visible; if (!_hasOffFrameBeenShown) { OffFrameGridColumn.Width = new GridLength(600); _hasOffFrameBeenShown = true; } else { OffFrameGridColumn.Width = new GridLength(_offFrameWidthWhenLastHidden); } } if (message.CanGoBack) { OffBackNavButton.Visibility = Visibility.Visible; } else { OffBackNavButton.Visibility = Visibility.Collapsed; } } } else { NavigationView.IsBackEnabled = message.CanGoBack; } }