I want to get the coordinates (rectangle borders: x, y, width and height) of the selected item in the list view relative to the screen (suppose the listview fills the entire screen), so I can create an object at this location and animate it to display some details selected item in my Xamarin.Forms application.
listview in xaml:
<ListView ItemTapped="ItemTapped"
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0.5, 0.5, 1.0, 1.0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Height="50">
<AbsoluteLayout>
<Label Text="{Binding Info}"
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0.1, 0.5, 0.7, 0.5"/>
</AbsoluteLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
C # code for ItemTapped event:
void ItemTapped(object sender, EventArgs args)
{
var listView = (ListView)sender;
var selectedItem = args.Item;
var selectedItemBounds = ...
...
}
In the end, I want to create something like this in Xamarin.Forms with listview (the number of objects in the list changes):

source
share