I tried Google how to make drag and drop for UIElements on Canvas, but couldn't find anything I was looking for.
I got a C # WPF application with a window. Inside the window, I have a canvas on which I can add images. I want to be able to drag and drop images and leave them at the borders of the canvas. I also want this to be in code, so not in xaml.
I got this in a function where I add / update images on canvas. TODO should be replaced for drag and drop events.
Image img = ImageList[i].Image;
img.Name = "Image" + i;
// TODO: Drag and Drop event for Image
// TODO: Check if Left and Top are within Canvas (minus width / height of Image)
Canvas.SetLeft(img, Left); // Default Left when adding the image = 0
Canvas.SetTop(img, Top); // Default Top when adding the image = 0
MyCanvas.Children.Add(img);
OnPropertyChanged("MyCanvas");
PS: Although it will be later, if someone has the code to drag and drop multiple images at once as an added bonus, I would appreciate it.
Thanks in advance for your help.