FileOpenPickerActivatedEventArgs 类

定义

提供有关用户尝试选取应用提供的文件或文件夹时触发的已激活事件的信息。

Javascript 此类型显示为 WebUIFileOpenPickerActivatedEventArgs

public ref class FileOpenPickerActivatedEventArgs sealed : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
public ref class FileOpenPickerActivatedEventArgs sealed : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileOpenPickerActivatedEventArgs final : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileOpenPickerActivatedEventArgs final : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileOpenPickerActivatedEventArgs : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileOpenPickerActivatedEventArgs : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
Public NotInheritable Class FileOpenPickerActivatedEventArgs
Implements IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
Public NotInheritable Class FileOpenPickerActivatedEventArgs
Implements IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
继承
Object Platform::Object IInspectable FileOpenPickerActivatedEventArgs
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

文件选取器协定示例演示如何响应 FileOpenPicker 激活点。

// File open picker activated event handler
protected override void OnFileOpenPickerActivated(FileOpenPickerActivatedEventArgs args)
{
    var FileOpenPickerPage = new SDKTemplate.FileOpenPickerPage();
    FileOpenPickerPage.Activate(args);
}

// Overloaded method to respond to fileOpenPicker events
public void Activate(FileOpenPickerActivatedEventArgs args)
{
    // Perform tasks to prepare your app to display its file picker page

    // Get file picker UI
    fileOpenPickerUI = args.FileOpenPickerUI;

    Window.Current.Content = this;
    this.OnNavigatedTo(null);
    Window.Current.Activate();
}

对于 C#, args 对于 OnFileOpenPickerActivated 重写引用 FileOpenPickerActivatedEventArgs 对象。 OnFileOpenPickerActivated 替代位于 App.xaml.cs 文件中,Activate方法位于文件选取器协定示例的 FileOpenPickerPage.xaml.cs 文件中。

注解

在快速入门:通过 Windows.Storage.Pickers.Provider 命名空间参考中的 和 提供文件服务中了解如何提供用户从你的应用中选取的文件。

当用户想要选取应用提供的文件或文件夹时,FileOpenPickerActivatedEventArgs 对象将传递到应用的已激活事件处理程序。 此类型的激活由 Kind 属性返回的 ActivationKind.FileOpenPicker 值指示。

用 JavaScript 编写的应用必须侦听并处理 Windows.UI.WebUI.webUIApplication.activated 事件。

使用 C++、C# 或 Visual Basic 的 UWP 应用通常通过重写 Application 对象的方法来实现激活点。 默认模板 app.xaml 代码隐藏文件始终包含 OnLaunched 的替代,但为其他激活点(如 OnFileOpenPickerActivated )定义替代取决于应用代码。

激活方案涉及的所有 应用程序 替代都应在其实现中调用 Window.Activate

版本历史记录

Windows 版本 SDK 版本 增值
1607 14393 User

属性

CallerPackageFamilyName

启动应用的应用的程序包系列名称。

FileOpenPickerUI

获取用户想要选取应用提供的文件或文件夹时显示的文件选取器字母框 UI。

Kind

获取激活类型。

PreviousExecutionState

获取激活前的应用的执行状态。

SplashScreen

获取一个 SplashScreen 对象,该对象提供有关从初始屏幕到激活的应用的转换的信息。

User

获取为其激活应用的用户。

适用于

另请参阅