Это код, который я использую для выбора одного или нескольких файлов:
Код: Выделить всё
public async void addLibraryFromFilesEvent(object sender, RoutedEventArgs args)
{
// Get top level from the current control. Alternatively, you can use Window reference instead.
var topLevel = TopLevel.GetTopLevel(this);
// Start async operation to open the dialog.
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = "Select one or more images",
AllowMultiple = true,
FileTypeFilter = [FilePickerFileTypes.ImageAll]
});
if (files.Count
Подробнее здесь: [url]https://stackoverflow.com/questions/79002181/long-term-file-access-on-avalonia-cross-platform-application[/url]