Open any kind of file with an uwp app (without file association)

后端 未结 2 1456
终归单人心
终归单人心 2021-01-15 12:59

I am making a simple uwp text editor app. I want the app to open any kind of file even without file associations declared since there are many text files which don\'t have k

相关标签:
2条回答
  • 2021-01-15 13:43

    Great question, but I'm afraid you could not modify the registry to make the app available in Open-With list even without file associations declared within UWP app. And file association is only way to make the app could handle the file activation. Both Windows desktop applications and Universal Windows Platform (UWP) apps can register to be a default file handler. If you do want this feature please feel free post your requirement with windows feed back hub app.

    0 讨论(0)
  • 2021-01-15 13:51

    In Windows 10 2004 (build 19041) microsoft introduced uap10:FileType attribute in package manifest and by providing * as the value the app is available in open with menu of all types of files. To use this just add the following code to your manifest:

    xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
    ...
    <uap:Extension Category="windows.fileTypeAssociation">
      <uap:FileTypeAssociation Name="anyfile">
        <uap:Logo>Assets\mylogo.png</uap:Logo>
        <uap:SupportedFileTypes>
          <uap:FileType>.txt</uap:FileType>
          <uap10:FileType>*</uap10:FileType>
        </uap:SupportedFileTypes>
      </uap:FileTypeAssociation>
    </uap:Extension>
    

    This only works for Windows 10 build 19041 and above. The additional uap:FileType is necessary if app targets minimum version below 19041 to pass manifest validation, otherwise it can be omitted.

    0 讨论(0)
提交回复
热议问题