title: GridView: Get Index on Drop Event
body: <p>How do I get the <strong>index</strong> or <strong>position</strong> where a <code>GridViewItem</code> is being dropped inside the <code>OnDrop</code> event of the <code>GridView</code>? As I have read around that it is possible with <code>GridView.ItemContainerGenerator.ContainerFromItem(item)</code> but for me <code>ItemContainerGenerator</code> is <code>null</code>.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>void gridMain_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
  {
      var item = e.Items.First();
      var source = sender;
      e.Data.Properties.Add("item", item);
      e.Data.Properties.Add("source", sender);
  }
  
  void gridMain_Drop(object sender, DragEventArgs e)
  {
      var item = e.Data.Properties.Where(p =&gt; p.Key == "item").Single();
  
      object source;
      e.Data.Properties.TryGetValue("source", out source);
      var s = ((GridView)source).ItemContainerGenerator.ContainerFromItem(item);
  }
  </code></pre>
  
  <p>Any hint or suggestion will be really helpful.</p>