I implemented the swiping gesture to a listview control, based on the sample code found here:
https://help.syncfusion.com/xamarin/listview/swiping#working-with-multiple-views-in-swipe-template
My list is grouped by department. When I swipe to perform an action, the itemIndex property is wrong. If the list isn’t grouped, the itemIndex for the selected item on the list is correct. Also, if the listview is grouped and I swipe the last item, the app throws an index exception and crashes.
How can I correct this issue?
Thanks in advance for your help.
Andres
private void ListView_SwipeEnded(object sender, Syncfusion.ListView.XForms.SwipeEndedEventArgs e)
{
var data = e.ItemData as Contacts;
var items = (ListView.BindingContext as ContactsViewModel).ContactsInfo;
var _index = items.IndexOf(items.FirstOrDefault(itemData => itemData == data));
App.Current.MainPage.DisplayAlert("Swiped item index", _index.ToString(), "Ok");
} |