如何将 uwp 应用程序集成到 jpg 的 windows 资源管理器的上下文菜单中?

How integrate uwp app into context menu of windows explorer for jpg?

我想将我的应用程序集成到 windows 资源管理器中。用户应该能够 select 多张图片并从上下文菜单中调用“调整大小”选项。 因此我创建了以下 windows.fileTypeAssociation

   <uap:Extension Category="windows.fileTypeAssociation">
      <uap3:FileTypeAssociation Name="bla" >
        <uap2:SupportedVerbs>
          <uap3:Verb Id="Resize" Extended="false" MultiSelectModel="Player">Resize</uap3:Verb>
          <uap3:Verb Id="Edit1" Extended="false" MultiSelectModel="Player">Edit1</uap3:Verb>
        </uap2:SupportedVerbs>
        <uap:SupportedFileTypes>
          <uap:FileType>.jpg</uap:FileType>
          <uap:FileType>.txt</uap:FileType>
          <uap:FileType>.banana</uap:FileType>
          <uap:FileType>.foo</uap:FileType>
        </uap:SupportedFileTypes>
      </uap3:FileTypeAssociation>
    </uap:Extension>

如果用户右键单击 .jpg 或 .txt 文件,则上下文菜单不包含菜单项“Resize”和“Edit1”。相反,它适用于扩展名为 .banana 和 .foo 的文件。 banana 文件类型扩展与另一个名为 bananaedit 的 uwp 应用相关联。扩展名 .foo 仅与我的应用程序相关。为什么我不能将上下文菜单项与 .jpg 或 txt 文件类型相关联或集成?

如何将 uwp 应用集成到 windows explorer for jpg 的上下文菜单中?

[编辑] Allow context menu verbs with file explorer integration without setting the app as default for the file type

的用户语音请求

[Edit2] 在此处为该功能点赞 (Feedbackhub) integrate context menu into windows explorer 4 #uwp
[Edit3] 在 github ProjectReunion

上为该功能点赞

你的代码没有任何问题。您只需对设备的默认应用设置进行一些更改。

在您的设备中,它安装了系统应用程序 Photos 应用程序,它也是 .jpg 文件类型的默认应用程序在您的设备中,Photos 应用程序不包含 ResizeEdit1 选项,因此当您右键单击 .jpg 文件,上下文菜单不包含菜单项 "Resize" 和 "Edit1",因此 .txt 文件格式,其默认文件类型 app 为 Notepad

至于.foo.banana文件类型,您的应用程序已自动设置为这些文件类型的默认应用程序你的应用程序关联了文件类型(你的应用程序可能是唯一一个关联文件类型的应用程序),所以当你右键单击 .foo[ 时,你可以看到 "Resize" 和 "Edit1" 选项=36=] 和 .banana 文件。

您可以在您的设备设置应用程序 => 应用程序 => 默认应用程序 => 按文件类型选择默认应用程序,如下图所示,

因此,如果您希望上下文菜单包含您的菜单项 "Resize" 和 "Edit1",当右键单击 .jpg 或 .txt 文件时,您应该指示用户将您的应用设置为默认应用.jpg 和 .txt 文件类型的应用程序。您可以使用 launch Apis to provide the user a convenient link to the privacy settings for that resource, see the topic Launch the Windows Settings app.