title: How to get coordinates of the selected item in a list view in Xamarin.Forms?
body: <p>I want to get the coordinates (rectangle bounds: x, y, width and height) of the selected item in the listview relative to the screen (assume the listview fills the whole screen), so that I can create an object at that location and animate it to display some details of the selected item in my Xamarin.Forms app.</p>
  
  <p>listview in xaml:</p>
  
  <pre><code>&lt;ListView ItemTapped="ItemTapped"
      AbsoluteLayout.LayoutFlags="All"
      AbsoluteLayout.LayoutBounds="0.5, 0.5, 1.0, 1.0"&gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;ViewCell Height="50"&gt;              
                  &lt;AbsoluteLayout&gt;
                      &lt;Label Text="{Binding Info}"
                          AbsoluteLayout.LayoutFlags="All"
                          AbsoluteLayout.LayoutBounds="0.1, 0.5, 0.7, 0.5"/&gt;
                  &lt;/AbsoluteLayout&gt;
              &lt;/ViewCell&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>c# code for ItemTapped event:</p>
  
  <pre><code>void ItemTapped(object sender, EventArgs args)
  {
      var listView = (ListView)sender; // the listview
      var selectedItem = args.Item; // the selected item
  
      // need to get selected item coordinates for the animation
      var selectedItemBounds = ...
  
      ...
  }
  </code></pre>
  
  <p>Eventually I want to create somehting like this in Xamarin.Forms with a listview (the number of objects in the listview varies):</p>
  
  <p><a href="https://i.stack.imgur.com/Vxhc7.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/Vxhc7.gif" alt="sample listview animation"></a></p>