private void NavigationLogic(ShowViewEvent evt) { if (CurrentView != null && CurrentView.ID == evt.ID) { return; } if (evt.ID == ViewList.Views.Back && PreviousView != null) { if (PreviousView.Count() > 0) { CurrentView = PreviousView.Pop(); if (CurrentView != null && !CurrentView.IsOverLay) { PreviousView.Clear(); } } return; } if (AvalableViews.ContainsKey(evt.ID)) { PreviousView.Push(CurrentView); CurrentView = AvalableViews[evt.ID]; if (!CurrentView.IsOverLay) { PreviousView.Clear(); } } FocusManager.SetIsFocusScope((DependencyObject)CurrentView.View, true); CommandManager.InvalidateRequerySuggested(); }
/// <summary> /// Navigates the back. /// </summary> public void NavigateBack() { ContentHost.Children.Clear(); if (PreviousView.Peek() != null) { CurrentView = PreviousView.Pop(); } ContentHost.Children.Add(CurrentView); }
/// <summary> /// Navigates to the target view without saving previous page. /// </summary> /// <param name="view">The view.</param> public void NavigateWithoutBackTo(UIElement view) { CurrentView = null; CurrentView = view; ContentHost.Children.Clear(); ContentHost.Children.Add(CurrentView); if (PreviousView.Count > 0) { PreviousView.Pop(); } }