IModalNavigationPlatform.PushModalAsync(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.
Presents modal on top of
CurrentPlatformPage.
public:
System::Threading::Tasks::Task ^ PushModalAsync(Microsoft::Maui::Controls::Page ^ modal, bool animated);
public System.Threading.Tasks.Task PushModalAsync(Microsoft.Maui.Controls.Page modal, bool animated);
abstract member PushModalAsync : Microsoft.Maui.Controls.Page * bool -> System.Threading.Tasks.Task
Public Function PushModalAsync (modal As Page, animated As Boolean) As Task
Parameters
- modal
- Page
The page to present. It has already been added to PlatformModalStack when this method is called.
- animated
- Boolean
true to animate the transition.
Returns
A task that completes once the modal is on screen and safe to dismiss. The framework awaits this task before applying any further modal operation, so completing early can allow a subsequent pop to race the presentation.
Remarks
If this task faults the framework removes modal from PlatformModalStack again, because the modal is not on screen. The cross-platform modal stack is left untouched, so Navigation.ModalStack still contains the page and the next reconciliation pass retries the presentation.
Where the fault surfaces depends on when the operation is applied. When IsReady was true at request time the push is applied inline and the fault is rethrown to the caller of Navigation.PushModalAsync. When the push was deferred because IsReady was false, that caller has already completed, so the fault is instead logged through the window's ILogger and cannot be observed by navigation code. Backends that need deferred failures to be actionable should surface them themselves.