IModalNavigationPlatform.PopModalAsync(Page, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Dismisses modal, revealing
CurrentPlatformPage.
public:
System::Threading::Tasks::Task ^ PopModalAsync(Microsoft::Maui::Controls::Page ^ modal, bool animated);
public System.Threading.Tasks.Task PopModalAsync(Microsoft.Maui.Controls.Page modal, bool animated);
abstract member PopModalAsync : Microsoft.Maui.Controls.Page * bool -> System.Threading.Tasks.Task
Public Function PopModalAsync (modal As Page, animated As Boolean) As Task
Parameters
- modal
- Page
The page to dismiss. It has already been removed from PlatformModalStack when this method is called, so CurrentPlatformPage already refers to the page that is about to be revealed.
- animated
- Boolean
true to animate the transition. The framework preserves
the value supplied to Navigation.PopModalAsync, including when the dismissal has to be
deferred until IsReady becomes true. For a pop that comes from
reconciling a stack the app changed wholesale (for example a Shell pop-to-root),
the value recorded for the matching push is used.
Returns
A task that completes once the modal is off screen.
Remarks
Implementations are responsible for releasing the platform views created for modal. The framework detaches the page from its parent after this task completes.
This must be idempotent. It is called for a page the backend already dismissed natively when that dismissal is routed back through Navigation.PopModalAsync, and it must complete successfully rather than throw in that case.
If this task faults the framework puts modal back on PlatformModalStack, because a failed dismissal means the modal is presumed to still be on screen and dropping it would leave a visible modal that no stack knows about. The cross-platform modal stack is left without the page, so the next reconciliation pass retries the dismissal — and animated is preserved across that retry. As with PushModalAsync(Page, Boolean), the fault is rethrown to the caller of Navigation.PopModalAsync only when the pop was applied inline; a deferred pop that faults is logged instead.