We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Swype gets wrong index values after enable grouping.

Hello,

Initially SfListView is working fine and swipe returns the correct index for the swiped register.

But, after setup same code to use grouping in order SfListView shows items organized by category, then swipe returns wrong values for the swiped registers.

I Have only added the <sf:SfListView.GroupHeaderTemplate> tag to the XAML and listView.DataSource.GroupDescriptors.Add() line to the code behind.

Has anyone here ever been through this issue and can tell me how to get work around it?

The code is available at GitHub

Thanks,

LKnett

1 Reply

GP Gnana Priya Namasivayam Syncfusion Team November 21, 2019 11:58 AM UTC

Hi Leopoldo, 
Thank you for using Syncfusion products.  
  
We have checked the reported query “Swipe returns wrong index for the item when Grouping is enabled. We let you know that the ItemIndex does not represent the index of the item in the ItemsSource collection, it represents the index of display items of SfListView. Hence you can achieve your requirement by using ItemData which you can get in SwipeEndedEventArgs instead of ItemIndex.  
  
Please refer the following code example for the same, 
        private void ListView_SwipeEnded(object sender, SwipeEndedEventArgs e) 
        { 
            var data = e.ItemData as Register; 
            var registers = listView.ItemsSource as List<Register>; 
            _index = registers.FindIndex(itemData => itemData == data); 
        } 
We hope this helps. Please let us know if you would require any further assistance. 
  
Regards 
Gnana Priya N

Loader.
Live Chat Icon For mobile
Up arrow icon