title: How do you get the drag drop drop target object?
body: <p>I'm hoping the title wasn't too confusing, wasn't entirely sure how to describe it. Anyway!</p>
  
  <p>I have a treeview with hierarchicalDataTemplates, as shown here;</p>
  
  <pre><code>&lt;TreeView.Resources&gt;
  
                 &lt;HierarchicalDataTemplate DataType="{x:Type WPFFM:AssetCategoryViewModel}" ItemsSource="{Binding Path= Children}" &gt;
                  &lt;StackPanel Orientation="Horizontal" AllowDrop="True" Drop="StackPanel_Drop" DragEnter="StackPanel_DragEnter"&gt;
                   &lt;TextBlock Text= "{Binding Description}" ContextMenu="{StaticResource assetOverviewContextMenu}"/&gt;
                  &lt;/StackPanel&gt;
                 &lt;/HierarchicalDataTemplate&gt;
  
                 &lt;HierarchicalDataTemplate DataType="{x:Type WPFFM:AssetViewModel}" ItemsSource="{Binding Children}" &gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                   &lt;TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch"  ContextMenu="{StaticResource assetContextMenu}"
                                                      PreviewMouseLeftButtonDown="Asset_PreviewMouseLeftButtonDown" PreviewMouseMove="Asset_PreviewMouseMove"    /&gt;
                  &lt;/StackPanel&gt;
                 &lt;/HierarchicalDataTemplate&gt;
  
  &lt;/TreeView.Resources&gt;
  </code></pre>
  
  <p>I've set AllowDrop to true on the category headers, and i've set some handling up for dragging assets between the two. Here's my code for Dragging;</p>
  
  <pre><code>private void Asset_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      {
          startPoint = e.GetPosition(null);
      }
  
      private void Asset_PreviewMouseMove(object sender, MouseEventArgs e)
      {
          // Get the current mouse position
          Point mousePos = e.GetPosition(null);
          Vector diff = startPoint - mousePos;
  
          if (e.LeftButton == MouseButtonState.Pressed &amp;&amp;
              Math.Abs(diff.X) &gt; SystemParameters.MinimumHorizontalDragDistance ||
              Math.Abs(diff.Y) &gt; SystemParameters.MinimumVerticalDragDistance)
          {
  
  
              TextBlock parentMenu = sender as TextBlock;
              AssetViewModel assetViewModelToSend = ((AssetViewModel)parentMenu.DataContext);
  
  
  
              // Initialize the drag &amp; drop operation
              DataObject dragData = new DataObject("myFormat", assetViewModelToSend);
              DragDrop.DoDragDrop(parentMenu, dragData, DragDropEffects.Move);
          } 
      }
  </code></pre>
  
  <p>And dropping;</p>
  
  <pre><code>private void StackPanel_Drop(object sender, DragEventArgs e)
      {
          //TextBlock parentMenu = e as TextBlock;
          //AssetCategoryViewModel assetCat = ((AssetCategoryViewModel)parentMenu.DataContext);
  
          //MessageBox.Show(parentMenu.Text);
  
  
          if (e.Data.GetDataPresent("myFormat"))
          {
              AssetViewModel modelBeingSent = e.Data.GetData("myFormat") as AssetViewModel;
              MessageBox.Show(modelBeingSent.Description);
  
          }
      }
  
      private void StackPanel_DragEnter(object sender, DragEventArgs e)
      {
          if (!e.Data.GetDataPresent("myFormat") ||
      sender == e.Source)
          {
              e.Effects = DragDropEffects.None;
          }
      }
  </code></pre>
  
  <p>This works fine and i can get my viewmodel from the dragEventArgs and drag them across, however i need to find the new category viewmodel that i'm dragging it into, but how do you get the drop targets data? Is it perhaps something in the sender or args?</p>
  
  <p>edit: For clarity here's a picture of my view. The drag source would be the child ( The laptop), and the drop target would be the category (hardware etc).</p>
  
  <p><img src="https://i.stack.imgur.com/Frci5.png" alt="asset overview"></p>