Replies: 2 comments
-
Clipboard needs some refractoring. See #11011 . For now, I use access to the WPF Clipboard on Windows. Luckily I don't have to target other OS, so that works for me. Don't know if it will work for you. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello stranger! This discussion was closed, but i have solution for you if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
desktop.MainWindow?.Clipboard is not { } clipboard || desktop.MainWindow?.StorageProvider is not { } storageProvider)
{
return;
}
IStorageFile? file = await storageProvider.TryGetFileFromPathAsync("/some/path/to/file");
if (file != null)
{
DataObject dataObject = new();
dataObject.Set(DataFormats.Files, new List<IStorageFile> { file });
await clipboard.SetDataObjectAsync(dataObject);
} It was worked for me. I found this line This code let you copy file by path in clipboard |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There doesn't seem to be documentation on how to copy a local file to the clipboard. I tried the following but it copies something that is not able to be pasted on Windows.
When copying a file on Windows and using
Clipboard.GetDataAsync
I get an enumerable ofBclStorageFile
, but this is an internal class. What am I supposed to pass as an argument to SetDataAsync to set a file?Beta Was this translation helpful? Give feedback.
All reactions