Language

IModalNavigationPlatform.PageAttached Method

Definition

Called when the window's page gets a handler, including when the page is replaced.

public:
 void PageAttached();
public void PageAttached();
abstract member PageAttached : unit -> unit
Public Sub PageAttached ()

Remarks

Use this to attach platform hooks that depend on the window's content being realized, such as a hardware back button handler. This may be called multiple times for the same window. It is also called once immediately after the instance is created when the window's page already has a handler, so a backend that resolves late does not miss the notification.

The framework guarantees it is never delivered twice for the same page-handler attachment, and that the built-in platform is never notified for an attachment that this instance handles. Notification is withheld until the window has a service scope — until then the framework cannot tell whether a factory is registered, and notifying the built-in platform early would leave its hooks installed alongside this instance's.

If this method throws, the framework logs the exception and continues attaching the page. The notification is considered delivered and is not retried for the same page-handler attachment.

Applies to