diff --git a/src/Core2D/Behaviors/DragAndDrop/EditorDropHandler.cs b/src/Core2D/Behaviors/DragAndDrop/EditorDropHandler.cs index 2b92f5ade..59528bd9d 100644 --- a/src/Core2D/Behaviors/DragAndDrop/EditorDropHandler.cs +++ b/src/Core2D/Behaviors/DragAndDrop/EditorDropHandler.cs @@ -65,7 +65,7 @@ private bool Validate(ProjectEditorViewModel editor, object? sender, DragEventAr if (e.Data.Contains(DataFormats.Files)) { - var files = e.Data.GetFileNames()?.ToArray(); + var files = e.Data.GetFiles()?.ToArray(); if (bExecute) { if (files is { }) diff --git a/src/Core2D/Behaviors/DragAndDrop/PageDropHandler.cs b/src/Core2D/Behaviors/DragAndDrop/PageDropHandler.cs index eceef3d36..082ba8d1d 100644 --- a/src/Core2D/Behaviors/DragAndDrop/PageDropHandler.cs +++ b/src/Core2D/Behaviors/DragAndDrop/PageDropHandler.cs @@ -65,7 +65,7 @@ private bool Validate(ProjectEditorViewModel editor, object? sender, DragEventAr if (e.Data.Contains(DataFormats.Files)) { - var files = e.Data.GetFileNames()?.ToArray(); + var files = e.Data.GetFiles()?.ToArray(); if (bExecute) { editor?.OnDropFiles(files, point.X, point.Y); diff --git a/src/Core2D/ViewModels/Editor/ProjectEditorViewModel.Editor.cs b/src/Core2D/ViewModels/Editor/ProjectEditorViewModel.Editor.cs index 04651ad28..f526bc403 100644 --- a/src/Core2D/ViewModels/Editor/ProjectEditorViewModel.Editor.cs +++ b/src/Core2D/ViewModels/Editor/ProjectEditorViewModel.Editor.cs @@ -7,6 +7,7 @@ using System.Reactive.Disposables; using System.Reactive.Subjects; using System.Threading.Tasks; +using Avalonia.Platform.Storage; using Core2D.Model; using Core2D.Model.Editor; using Core2D.Model.Renderer; @@ -888,7 +889,7 @@ public void OnRedo() } } - public async Task OnDropFiles(string[]? files, double x, double y) + public async Task OnDropFiles(IStorageItem[]? files, double x, double y) { try { @@ -899,8 +900,9 @@ public async Task OnDropFiles(string[]? files, double x, double y) var result = false; - foreach (var path in files) + foreach (var file in files) { + var path = file.TryGetLocalPath(); if (string.IsNullOrEmpty(path)) { continue;