public interface INativeDirectoryPicker Optional directory-selection support for a native file picker.
Properties
IsDirectorySelectionAvailable
bool IsDirectorySelectionAvailable { get; } Whether directory selection can work now. A picker that checks its backend in advance, such as an XDG desktop portal that may be missing from the session bus, returns false once it knows the backend is missing, so the platform.directories.open capability reports it before a pick. The default is true.
Remarks
A picker still receives selection calls while it returns false, so it can check again.
SupportsMultipleDirectorySelection
bool SupportsMultipleDirectorySelection { get; } Whether INativeDirectoryPicker.SelectDirectoriesAsync is implemented.
Methods
SelectDirectoriesAsync
ValueTask<IReadOnlyList<NativeDirectorySelection>?> SelectDirectoriesAsync(string? initialDirectory, CancellationToken cancellationToken) Shows one owned directory dialog that lets the user select several directories; null or an empty list means dismissal. Acquired access transfers to the caller.
Remarks
The default throws NativeBackendUnavailableException. A picker that implements it also returns true from INativeDirectoryPicker.SupportsMultipleDirectorySelection.
SelectDirectoriesAsync
ValueTask<IReadOnlyList<NativeDirectorySelection>?> SelectDirectoriesAsync(NativeFileDialogRequest request, CancellationToken cancellationToken) Shows one owned directory dialog for request that lets the user select several directories; null or an empty list means dismissal.
Remarks
The NativePickerBackend calls this overload. The default ignores the title and calls INativeDirectoryPicker.SelectDirectoriesAsync.
SelectDirectoryAsync
ValueTask<NativeDirectorySelection?> SelectDirectoryAsync(string? initialDirectory, CancellationToken cancellationToken) Shows one owned directory dialog that opens in initialDirectory where supported; null means dismissal. Acquired access transfers to the caller.
SelectDirectoryAsync
ValueTask<NativeDirectorySelection?> SelectDirectoryAsync(NativeFileDialogRequest request, CancellationToken cancellationToken) Shows one owned directory dialog for request: its NativeFileDialogRequest.InitialDirectory and NativeFileDialogRequest.Title; null means dismissal.
Remarks
The NativePickerBackend calls this overload. The default ignores the title and calls INativeDirectoryPicker.SelectDirectoryAsync.