CoreApplication.LeavingBackground Event
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.
Fired just before application UI becomes visible.
// Register
static event_token LeavingBackground(EventHandler<LeavingBackgroundEventArgs> const& handler) const;
// Revoke with event_token
static void LeavingBackground(event_token const* cookie) const;
// Revoke with event_revoker
static CoreApplication::LeavingBackground_revoker LeavingBackground(auto_revoke_t, EventHandler<LeavingBackgroundEventArgs> const& handler) const;
public static event System.EventHandler<LeavingBackgroundEventArgs> LeavingBackground;
function onLeavingBackground(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("leavingbackground", onLeavingBackground);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("leavingbackground", onLeavingBackground);
- or -
Windows.ApplicationModel.Core.CoreApplication.onleavingbackground = onLeavingBackground;
Public Shared Custom Event LeavingBackground As EventHandler(Of LeavingBackgroundEventArgs)
Device family |
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v3.0)
|
Previously the best location to load UI was in your activated or resuming event handler. Now your handler for the LeavingBackground event is the best place to do your final checks to ensure that the UI is ready for presentation. It is important to check that visual assets are ready by this time because this is the last opportunity to do work before your application is visible to the user.
Product | Versions |
---|---|
WinRT | Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |