-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Missing FileDialog filter options #2949
Comments
@kekekeks @danwalmsley can this reasonably be implemented on all our dialog backends? |
OSX file dialogs don't use glob patterns and need a list of accepted file extensions or UTIs |
Is there any workaround to such a problem? |
On OSX? No, I don't think we can restrict the system file dialog to use a fixed name. |
I'm targeting only Win and Linux, so OSX is not the case. What will be the best solution to have a strict filename inside file dialog (and not swtiching to WPF instead of avalonia)? |
Copy-pasting dialog implementations and altering them to fit your needs, I guess. |
Will throw an ArgumentException, as a filter has been defined. Without the filter it works just fine. |
This is untenable because many of the internal APIs used are protected and inaccessible, and we end up needing to vendor a large chunk of Avalonia, not to mention requiring A proper solution is needed on Windows and GTK for this. The alternative here is to drop down to WPF just for an Edit: It seems like |
Filter as it is in WPF won't be supported in Avalonia. class FilePickerFileType
{
string Title { get; init; }
// For desktop
IReadOnlyList<string> Extensions {get; init; }
// For web and android
IReadOnlyList<string> MimeTypes {get; init; }
// For Apple platforms
IReadOnlyList<string> AppleUniformTypeIdentifiers {get; init; }
} |
Will |
You can set suggested file name and a type extension. Not much flexibility here with non-windows platforms. |
In addition to Windows, GTK also allows glob-style filters. It is only macOS and mobile/web platforms that do not support this. There is already a specialization for Apple platforms with UTIs that are only relevant on macOS. It would not be difficult to add a property to support fixed filename filters on platforms that support it, which does not just include Windows. |
To be clear here I am not asking for full support of WPF style globs. Simply allowing the file picker to filter on a fixed name will already go a long way, and is well supported on both Windows and GTK. |
Well, I suppose glob pattern support won't be a problem as part of new API. |
If full support for globs made it in that would be great as well but just having support for fixed file names would already cover 95% of use cases when including the existing extension based filter. The only thing is if extensions are only relevant for non-macOS desktop environments, then all such environments already support globs. |
There are only 2 options that can be used in filters for FileDialog - InitialFileName and Extensions
In WPF I can specify filter to choose only files named as "Name.exe" in this way:
Requesting to add missing FileDialog's filter options (based on WPF) to Avalonia
The text was updated successfully, but these errors were encountered: