Skip to content

Order of FileTypeChoices in new pickers is not respected #5827

Closed

Description

@Marv51

Describe the bug

In Windows.Storage.Pickers.FileSavePicker under FileTypeChoices it says:

If you add multiple FileTypeChoices to the FileSavePicker, the first one added is the default file type. This default will be selected when the user opens the file picker.

https://learn.microsoft.com/en-us/uwp/api/windows.storage.pickers.filesavepicker.filetypechoices?view=winrt-26100

In the new Microsoft.Windows.Storage.Pickers.FileSavePicker there seems to be no way to influence the order of FileTypeChoices as the input order is not the displayed order. The order seems to be always alphabetically, with the alphabetically-first being selected by default.

I thought setting DefaultFileExtension would set the default FileTypeChoice. But it does not. It only seems to work when no FileTypeChoices are added.

Steps to reproduce the bug

// using Microsoft.Windows.Storage.Pickers;

var savePicker = new FileSavePicker(this.AppWindow.Id)
{
    SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
    SuggestedFileName = "MyFile"
};

savePicker.DefaultFileExtension = ".ods";

savePicker.FileTypeChoices.Add("PDF", [".pdf"]);
savePicker.FileTypeChoices.Add("ABC", [".txt"]);
savePicker.FileTypeChoices.Add("Tabellenformat", [".ods"]);

await savePicker.PickSaveFileAsync();

Expected behavior

Same behavior as WinRT API where the order is respected and the first is the default. Or a way to set a default FileTypeChoice manually (see also IFileDialog::SetFileTypeIndex)

Screenshots

No response

NuGet package version

Windows App SDK 1.8.0: 1.8.250907003

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (26100, June 2025 Update)

IDE

Visual Studio 2022

Additional context

No response

Activity

  1. beeradmoore commented on Sep 13, 2025

    @beeradmoore

    I dont think this ever worked (either that or my code was broken).

    In DLSS Swapper I use Win32 generated stuff and it didn't seem to work. I just tested trying to set it to csv and .csv but when I open it it is always .json which is the first in my list. This is the same for my open and save dialog code.

  2. tipa commented on Sep 19, 2025

    @tipa

    I'm having the same problem. In my app the user can export a file to various different file formats and I want to pre-select the file format that the user used in previous export operations. This worked using the old Windows.Storage.Pickers.FileSavePicker, but not with the new one

  3. added
    area-File accessTopics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.
    on Sep 22, 2025
  4. DinahK-2SO commented on Dec 4, 2025

    @DinahK-2SO
    Contributor

    Hi Marvin Rühe (@Marv51), thank you for taking the time to report this issue, and sharing the repro details.

    The fix is merged and will be available from versions 2.0-exp4 and 1.8.4.

    Thanks Marvin Rühe (@Marv51), Brad (@beeradmoore) , Timo Partl (@tipa) , Mahdi Hosseini (@ghost1372) again. Your input helps us improve and deliver a better experience to the community.

  5. Marv51 commented on Dec 4, 2025

    @Marv51
    ContributorAuthor

    Hi Dinah Xiaoman G (@DinahK-2SO),

    Thank you for the quick fix and the good communication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-File accessTopics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions