Source/Xamarin/Prism.Forms/Navigation/PageNavigationService.cs
/// <summary>
/// Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack.
/// </summary>
/// <param name="parameters">The navigation parameters</param>
/// <param name="useModalNavigation">If <c>true</c> uses PopModalAsync, if <c>false</c> uses PopAsync</param>
/// <param name="animated">If <c>true</c> the transition is animated, if <c>false</c> there is no animation on transition.</param>
/// <returns>If <c>true</c> a go back operation was successful. If <c>false</c> the go back operation failed.</returns>
Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack.
Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack .
public virtual async Task<bool> GoBackAsync(NavigationParameters parameters = null, bool? useModalNavigation = null, bool animated = true)
        {
            try
            {
                NavigationSource = PageNavigationSource.NavigationService;
                var page = GetCurrentPage();
                var segmentParameters = UriParsingHelper.GetSegmentParameters(null, parameters);
                segmentParameters.Add(KnownNavigationParameters.NavigationMode, NavigationMode.Back);
                var canNavigate = await CanNavigateAsync(page, segmentParameters);
                if (!canNavigate)
                    return false;                
                bool useModalForDoPop = UseModalNavigation(page, useModalNavigation);
                Page previousPage = PageUtilities.GetOnNavigatedToTarget(page, _applicationProvider.MainPage, useModalForDoPop);
                PageUtilities.OnNavigatingTo(previousPage, segmentParameters);
                var poppedPage = await DoPop(page.Navigation, useModalForDoPop, animated);
                if (poppedPage != null)
                {
                    PageUtilities.OnNavigatedFrom(page, segmentParameters);
                    PageUtilities.OnNavigatedTo(previousPage, segmentParameters);
                    PageUtilities.DestroyPage(poppedPage);
                    return true;
                }
            }
            catch (Exception e)
            {
                _logger.Log(e.ToString(), Category.Exception, Priority.High);
                return false;
            }
            finally
            {
                NavigationSource = PageNavigationSource.Device;
            }
            return false;
        }
public virtual async Task < bool > GoBackAsync ( NavigationParameters parameters = null , bool ? useModalNavigation = null , bool animated = true ) { try { NavigationSource = PageNavigationSource . NavigationService ; var page = GetCurrentPage ( ) ; var segmentParameters = UriParsingHelper . GetSegmentParameters ( null , parameters ) ; segmentParameters . Add ( KnownNavigationParameters . NavigationMode , NavigationMode . Back ) ; var canNavigate = await CanNavigateAsync ( page , segmentParameters ) ; if ( ! canNavigate ) return false ; bool useModalForDoPop = UseModalNavigation ( page , useModalNavigation ) ; Page previousPage = PageUtilities . GetOnNavigatedToTarget ( page , _applicationProvider . MainPage , useModalForDoPop ) ; PageUtilities . OnNavigatingTo ( previousPage , segmentParameters ) ; var poppedPage = await DoPop ( page . Navigation , useModalForDoPop , animated ) ; if ( poppedPage != null ) { PageUtilities . OnNavigatedFrom ( page , segmentParameters ) ; PageUtilities . OnNavigatedTo ( previousPage , segmentParameters ) ; PageUtilities . DestroyPage ( poppedPage ) ; return true ; } } catch ( Exception e ) { _logger . Log ( e . ToString ( ) , Category . Exception , Priority . High ) ; return false ; } finally { NavigationSource = PageNavigationSource . Device ; } return false ; }
Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack.
Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack .
None
parameters
NavigationParameters
The navigation parameters
The navigation parameters
useModalNavigation
bool?
None
animated
bool
None