This is not directly supported, because the system only recognizes each file extension as a single type. You do have a few options though.
- Create a different file type for each file type
- Create a different file type for each file type, then rename the file to
.txt
after they've selected it.
Ex:
savePicker.FileTypeChoices.Add("Markdown Text", new List<string>() { ".mtxt" });
savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".ptxt" });
var file = await savePicker.PickSaveFileAsync();
await file.RenameAsync(file.DisplayName + ".txt");
This has the danger that it will not warn them if they have a file of that name already there though, so is not necessarily suggested.
- Have a checkbox/drop down next to the button you use to save the file that gives the option.
Of these, the first or the third are the most ideal. If there is a difference between them, it would be good to differentiate it in the file system. If that is still not desired, then giving them the option before they select to save is the best option.
Edit: @Krekkon's idea is good as well. Adding the option to a settings flyout is a good idea. You'll need to inform them that the option exists though. The other option is to use something like a MessageDialog
which popups up three buttons: Save as Plain Text
, Save as Markup
, Cancel
. This will unfortunately add a click to the flow, so may not be ideal. Personally I think adding a simple control next to the save button is simple and fine.