JavaCafe01
JavaCafe01

Reputation: 162

How to set a c# uwp app as a default app to open certain files?

I am currently making a text editor. If you right click on a text file, and scroll to the "open with" tab, there would be apps to open the file. How would you make your app be listed in that tab? Thanks for the help!

In other words, is there any c# code required to put your app in that listing?

Upvotes: 3

Views: 1489

Answers (2)

Jay Zuo
Jay Zuo

Reputation: 15758

To achieve this, we need to register the app as the default handler for a certain file type.

Both Windows desktop applications and Universal Windows Platform (UWP) apps can register to be a default file handler. If the user chooses your app as the default handler for a certain file type, your app will be activated when that type of file is launched.

And following is the steps to register for a file type.

  1. Specify the extension point in the package manifest
  2. Add the proper icons
  3. Handle the activated event

For more info, please see Handle file activation and the official Association launching sample (especially Scenario 3 Receiving a file) on GitHub.

Upvotes: 3

Shady3cho
Shady3cho

Reputation: 27

Usually what I do is that, I click on the browse option and point it to my application's executable and then after that it is will be listed on the options of applications to open with

Upvotes: 0

Related Questions