FileActivatedEventArgs FileActivatedEventArgs FileActivatedEventArgs FileActivatedEventArgs FileActivatedEventArgs Class

Definition

Provides data when an app is activated because it is the app associated with a file.

JavaScript This type appears as WebUIFileActivatedEventArgs.

public : sealed class FileActivatedEventArgs : IActivatedEventArgs, IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
struct winrt::Windows::ApplicationModel::Activation::FileActivatedEventArgs : IActivatedEventArgs, IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
public sealed class FileActivatedEventArgs : IActivatedEventArgs, IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
Public NotInheritable Class FileActivatedEventArgs Implements IActivatedEventArgs, IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The OnFileActivated event handler on the Application object receives all file activation events.

protected override void OnFileActivated(FileActivatedEventArgs args)
{
       // TODO: Handle file activation

       // The number of files received is args.Files.Size
       // The first file is args.Files[0].Name
}
Private Sub OnFileActivated(ByVal args As Windows.ApplicationModel.Activation.FileActivatedEventArgs)
      ' TODO: Handle file activation

      ' The number of files received is args.Files.Size
      ' The first file is args.Files(0).Name
End Sub
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs const& /* args */)
{
    // TODO: Handle file activation.

    // The number of files received is args.Files().Size().
    // The first file is args.Files().GetAt(0).Name().
}
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args)
{
       // TODO: Handle file activation

       // The number of files received is args->Files->Size
       // The first file is args->Files->GetAt(0)->Name
}

Remarks

This object is accessed when you implement an event handler to respond to Activated events when ActivationKind is File.

UWP app using C++, C#, or Visual Basic typically implement activation points by overriding methods of the Application object. The default template app.xaml code-behind files always include an override for OnLaunched, but defining overrides for other activation points such as OnFileActivated is up to your app code.

All Application overrides involved in an activation scenario should call Window.Activate in their implementations.

Note that when your app is activated for the file contract you must access the data using the StorageFile objects passed to your app through the Files property. You should not attempt to access the path of the file since your app may not have permission to the file’s location.

Properties

CallerPackageFamilyName CallerPackageFamilyName CallerPackageFamilyName CallerPackageFamilyName CallerPackageFamilyName

The package family name of the app that launched your app.

CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId

Gets the identifier for the currently shown app view.

Files Files Files Files Files

Gets the files for which the app was activated.

Kind Kind Kind Kind Kind

Gets the activation type.

NeighboringFilesQuery NeighboringFilesQuery NeighboringFilesQuery NeighboringFilesQuery NeighboringFilesQuery

Gets the neighboring files of the files for which the app was activated.

PreviousExecutionState PreviousExecutionState PreviousExecutionState PreviousExecutionState PreviousExecutionState

Gets the execution state of the app before it was activated.

SplashScreen SplashScreen SplashScreen SplashScreen SplashScreen

Gets the splash screen object that provides information about the transition from the splash screen to the activated app.

User User User User User

Gets the user that the app was activated for.

Verb Verb Verb Verb Verb

Gets the action associated with the activated file.

ViewSwitcher ViewSwitcher ViewSwitcher ViewSwitcher ViewSwitcher

Provides the object that allows you to set the view for the application.

See Also