共用方式為


AppWindow.CloseRequested 事件

定義

會在視窗開始關閉之後發生,但在關閉之前發生 Closed 事件之前發生。

// Register
event_token CloseRequested(TypedEventHandler<AppWindow, AppWindowCloseRequestedEventArgs const&> const& handler) const;

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

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

事件類型

備註

重要

只有在應用程式具有應用程式關閉確認限制功能 () <rescap:Capability Name="confirmAppClose"/> 時,才會發生此事件,因此不適用於大部分的應用程式。 如需詳細資訊,請參閱 應用程式功能宣告 - 受限制的功能

適用於

另請參閱