AppExtensionCatalog.PackageInstalled Event


Event that is fired when an extension package is installed.

// Register
event_token PackageInstalled(TypedEventHandler<AppExtensionCatalog, AppExtensionPackageInstalledEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
AppExtensionCatalog::PackageInstalled_revoker PackageInstalled(auto_revoke_t, TypedEventHandler<AppExtensionCatalog, AppExtensionPackageInstalledEventArgs const&> const& handler) const;
public event TypedEventHandler<AppExtensionCatalog,AppExtensionPackageInstalledEventArgs> PackageInstalled;
function onPackageInstalled(eventArgs) { /* Your code */ }
appExtensionCatalog.addEventListener("packageinstalled", onPackageInstalled);
appExtensionCatalog.removeEventListener("packageinstalled", onPackageInstalled);
- or -
appExtensionCatalog.onpackageinstalled = onPackageInstalled;
Public Custom Event PackageInstalled As TypedEventHandler(Of AppExtensionCatalog, AppExtensionPackageInstalledEventArgs) 

Event Type


The event argument, AppExtensionPackageInstalledEventArgs.Extensions, contains a list of extensions within the extension package.

Extensions are scoped by the <uap3:AppExtension Name=...> defined in the extension's Package.appxmanifest file. Only extensions that match the <uap3:AppExtension Name=...> defined in the host's Package.appxmanifest file, are in the list of extensions.

An event handler for this event is a good place to examine each app extension for correctness and to provide the user the option to use it.

The unit of deployment for an AppExtension is the Package. That's why this is a Package install event and not an AppExtension install event.

Typically there will only be one extension in a package. However, be prepared to handle the case where there are multiple extensions in the package.

Use AppExtension.Id to distinguish between extensions in the same package. To uniquely identify an extension in your app, consider concatenating AppInfo.AppUserModelId and AppExtension.Id:

_uniqueId = yourAppExtention.AppInfo.AppUserModelId + "!" + yourAppExtention.Id;

This guarantees that each AppExtension has a unique name that you can use to track it with in your app. We recommend using this as a key for your AppExtensions so that you can efficiently and correctly identify if a given AppExtension is one that you already know about.

Applies to