Share via


SystemNavigationManagerPreview.CloseRequested Event

Definition

Occurs when the user invokes the system button for close (the 'x' button in the corner of the app's title bar).

// Register
event_token CloseRequested(EventHandler<SystemNavigationCloseRequestedPreviewEventArgs> const& handler) const;

// Revoke with event_token
void CloseRequested(event_token const* cookie) const;

// Revoke with event_revoker
SystemNavigationManagerPreview::CloseRequested_revoker CloseRequested(auto_revoke_t, EventHandler<SystemNavigationCloseRequestedPreviewEventArgs> const& handler) const;
public event System.EventHandler<SystemNavigationCloseRequestedPreviewEventArgs> CloseRequested;
function onCloseRequested(eventArgs) { /* Your code */ }
systemNavigationManagerPreview.addEventListener("closerequested", onCloseRequested);
systemNavigationManagerPreview.removeEventListener("closerequested", onCloseRequested);
- or -
systemNavigationManagerPreview.oncloserequested = onCloseRequested;
Public Custom Event CloseRequested As EventHandler(Of SystemNavigationCloseRequestedPreviewEventArgs) 

Event Type

Windows requirements

App capabilities
confirmAppClose

Remarks

ClosedRequested events will not be raised for windows that are non-visible. For example an application window that is minimised but not suspended (multi-window, or with an active extended execution request) will not be closed or receive this event until the window is made visible by the user. Also in Tablet mode (Windows 10 only) the event will not be raised and the window will be closed when the user drags the window to the bottom of the screen. In all cases apps are expected to save user data when the app receives a suspend notification in case it never is woken again to save data.

The app must possess the confirmAppClose capability in order to receive this event. An app without the capability can register for the event, but the handler will not be called.

Applies to