title: C# Drag and Drop Image within Canvas
body: <p>I tried to Google how to make drag &amp; drop for UIElements on a Canvas, but couldn't find anything that I'm looking for.</p>
  
  <p>I got a C# WPF application with a Window. Inside the Window I got a Canvas where I can add Images to.
  What I want is to be able to Drag &amp; Drop the Images, while staying within the Canvas' borders. 
  I also want this to be in code, so not in the xaml.</p>
  
  <p>I got this in the function where I add/update the Images to the Canvas. The TODO's should be replaced for the Drag &amp; Drop events.</p>
  
  <pre><code>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");
  </code></pre>
  
  <p>PS: Though this is for later, if someone has code to drag and drop multiple images at once as an additional bonus, I would appreciate it.</p>
  
  <p>Thanks in advance for the help.</p>