Xamarin.Forms Guides | Samples

Xamarin.Forms.INavigation.PopModalAsync Method

Asynchronously dismisses the most recent modally presented Page.

Syntax

public System.Threading.Tasks.Task<Page> PopModalAsync ()

Returns

An awaitable Task<Page>, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.

Remarks

The following example shows PushModal and PopModal usage:

C# Example

var modalPage = new ContentPage ();
await Navigation.PushModalAsync (modalPage);
Debug.WriteLine ("The modal page is now on screen");
var poppedPage = await Navigation.PopModalAsync ();
Debug.WriteLine ("The modal page is dismissed");
Debug.WriteLine (Object.ReferenceEquals (modalPage, poppedPage)); //prints "true"
Note:

Application developers must await the result of INavigation.PushModal and INavigation.PopModal. Calling Task.Wait may cause a deadlock if a previous call to INavigation.PushModal or INavigation.PopModal has not completed.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0