/// <summary> /// If possible, discards the current page and displays the previous page /// on the navigation stack. /// </summary> public void GoBack() { CheckFrame(); if (_stack.Count >= 2) { // Remove current content var oldContent = _stack.Pop(); (oldContent as INavigable)?.OnNavigatingFrom(); if (_animationManager == null) { // Add the last entry in the stack to the UI _frame.Content = _stack.Peek(); (_frame.Content as INavigable)?.OnNavigatedTo(); } else { var newContent = _stack.Peek(); _animationManager.Animate( newContent, old => { (newContent as INavigable)?.OnNavigatedTo(); }); } } }