Skip to content

Supplements Missing Functionalities for FileOpenPicker.FileTypeFilter and FileSavePicker.FilterTypeChoices #5358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DinahK-2SO
Copy link
Contributor

Description

This PR addresses the following missing functionalities for FileOpenPicker.FileTypeFilter and FileSavePicker.FilterTypeChoices:

FileOpenPicker.FileTypeFilter

Test code (C++):

winrt::Microsoft::Windows::Storage::Pickers::FileOpenPicker picker{ AppWindow().Id() };
picker.FileTypeFilter().Append(L".jpg");
picker.FileTypeFilter().Append(L".png");
auto& file = co_await picker.PickSingleFileAsync();
  1. When FileTypeFilters are defined, append a file type filter that includes all the already defined file types.
    With this PR:
    image
    Without this PR:
    image

FileSavePicker.FilterTypeChoices

Test code (C++):

winrt::Microsoft::Windows::Storage::Pickers::FileSavePicker picker{ AppWindow().Id() };
picker.FileTypeChoices().Insert(L"Documents", single_threaded_vector<hstring>({ L".txt", L".doc", L".docx", L".pdf"}));
picker.FileTypeChoices().Insert(L"Pictures", single_threaded_vector<hstring>({ L".jpg", L"jpeg", L".png", L".bmp"}));
auto& file = co_await picker.PickSaveFileAsync();
  1. When FileTypeChoices are defined and a file is saved with an unknown extension, automatically append the first extension from the choices (utilizing the built-in protection mechanisms of the COM file dialog).
    With this PR:
    force-known-extensions
    Without this PR:
    force-known-extensions-beforefix

  2. When multiple categories are defined in FileTypeChoices, the suggested file extension should change according to the selected category.
    With this PR:
    alter-extension-with-choices
    Without this PR:
    alter-extension-with-choices-beforefix

@ghost1372
Copy link
Contributor

@DinahK-2SO
Wouldn't it be better if the All Files option was the first option? Currently, All Files is the last option.(I mean it should be placed before all types, not after them.)

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

Successfully merging this pull request may close these issues.

2 participants