I am trying to upload files using the drag and drop function. I was able to successfully complete the user interface, but I had problems accessing the object that was deleted in the backend. I was able to successfully capture the object if I made the code, but I am trying to use the MVVM approach.
AttachmentView.xaml
Cal:Message.Attach="[Drop] = [SaveFile($eventArgs)]"
AttachmentViewModel.cs
public virtual async void SaveFile(DragEventArgs e) { var fileStream = new FileStream([File name goes here], FileMode.Open, FileAccess.Read); }
I tried EventArgs, I could not find the property of the file object. DragEventArgs is null when the code is validated.
A working solution for code outside
AttachmentView.xaml.cs
private void ImagePanel_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
source share