title: Problems using inheritance with drag and drop in WPF
body: <p>I have a usercontrol that I want to implement a drag and drop interface on, here are the vital parts of the implementation, and this works fine:</p>
  
  <p>XML-file to the usercontrol to be draggable:</p>
  
  <pre><code>&lt;UserControl 
           ...default xmlns...
           MouseLeftButtonDown="Control_MouseLeftButtonDown"&gt;
           ...GUI-ELEMENTS in the control...
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>Code behind: </p>
  
  <pre><code>public partial class DragableControl : UserControl
  {
      private void Control_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      {
           DragDrop.DoDragDrop(this, this, DragDropEffects.Move);
      }
  }
  </code></pre>
  
  <p>XML-file to the usercontrol which will be able to accept a drag and drop operation:</p>
  
  <pre><code>&lt;Usercontrol 
           ...default xmlns...&gt;
      &lt;Grid AllowDrop="True" Drop="Grid_Drop"&gt;
           ... GUI elements in the grid....
      &lt;/Grid&gt; 
  &lt;/Usercontrol&gt;
  </code></pre>
  
  <p>Code behind: </p>
  
  <pre><code>public partial class DropClass: UserControl
  {
      private void Grid_Drop(object sender, DragEventArgs e)
      {
          var control = (DragableControl)e.Data.GetData(typeof(DragableControl));
          if(control != null)
          {
              //do something
          }        
      }
  }
  </code></pre>
  
  <p>To be able to create different usercontrols which have drag and drop functionality, I creates a base class, BaseDragableUserControl, which at the moment contains nothing, but inherits from usercontrol.</p>
  
  <p>Code:</p>
  
  <pre><code>public class BaseDragableUserControl: UserControl
  {
  }
  </code></pre>
  
  <p>I change my code (both xaml and code): </p>
  
  <pre><code> public partial class DragableControl : UserControl
  </code></pre>
  
  <p>I also changes the class for receiving  to this:</p>
  
  <pre><code>public partial class DropClass: UserControl
  {
      private void Grid_Drop(object sender, DragEventArgs e)
      {
          var control =(BaseDragableUserControl)e.Data.GetData(typeof(BaseDragableUserControl));
          if(control != null)
          {
              //do something
          }        
      }
  }
  </code></pre>
  
  <p>But the <strong>control</strong> variable is always Null. I guess that the getdata in the DragEventsArgs does not like inheritance. Is there a way to achieve this? To make it possible to use a base class for a drag and drop class?</p>