Skip to content
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

Add an option to show all files in OpenFolderPickerAsync #17284

Open
MajesticBevans opened this issue Oct 15, 2024 · 2 comments
Open

Add an option to show all files in OpenFolderPickerAsync #17284

MajesticBevans opened this issue Oct 15, 2024 · 2 comments

Comments

@MajesticBevans
Copy link

MajesticBevans commented Oct 15, 2024

Is your feature request related to a problem? Please describe.

When using TopLevel.StorageProvider.SaveFolderPickerAsync, only folders are displayed in the dialog (understandably, as files cannot be selected). However, this makes it quite difficult to identify what a folder actually is, as its contents cannot be viewed in the dialog. This means that when using my application, I find myself opening file explorer as well as the folder picker dialog, in order to identify which folder I want to select.

Describe the solution you'd like

I would like a new boolean field in FolderPickerOpenOptions, perhaps called 'ShowFiles' or 'DisplayContents', defaulted to false for backwards compatibility. When this is set to true, however, I would like all files to be displayed within the folder picker dialog, but greyed out (or with IsEnabled set to false?).

Describe alternatives you've considered

I have looked into overriding the behaviour of the OpenFolderDialogAsync, but the implementation classes are sealed, internal classes, so I think I would have to craft a new folder picker dialog from scratch, which would not nicely match with the file pickers and Avalonia.Platform.Storage functionalities already included.

Additional context

No response

@maxkatz6
Copy link
Member

It very much dependent on the specific platform.
MacOS, for example, should already include all items, but disable files, when selecting folders. Because that's how macOS UX usually works with pickers.
Making an extra parameter seems useless here, as it won't be respected by majority of platforms, and only affects visual representations of the dialog.

If this question is about managed file picker, we can implement similar behavior to macOS, without any extra parameters.

If this question is about Windows file picker, if Win32 API allows similar to macOS behavior, we can also do that without any extra parameter. But otherwise not much to do here.

@MajesticBevans
Copy link
Author

That's fair. Admittedly I haven't used Avalonia on Mac, so wasn't aware that it already did this. I've just tested on linux though, and its visual behaviour is consistent with Mac as well, so I agree that a new parameter doesn't really make sense, especially because directories should show at the top of the picker anyway so it shouldn't be confusing adding files in.

I'd instead just request, then, that the windows folder picker be changed to have consistent visual behaviour with the MacOS and linux implementations.

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

No branches or pull requests

2 participants