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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get the unselected items from sfListView

Thread ID:

Created:

Updated:

Platform:

Replies:

131602 Jul 19,2017 12:22 AM Jul 20,2017 02:03 AM Xamarin.Forms 3
loading
Tags: SfListView
pumaprog
Asked On July 19, 2017 12:22 AM

Hello!  I have a program that contains an sfListView.  It has an event OnSelectionChanged that runs some code and changes the visuals of a cell when a cell is tapped.  It then marks the cell as selected.  I can then call all of the selected cells and place them into a List<T> by calling listView.SelectedItems.  Is there a good solution for getting the items that were NOT selected?  

Dinesh Babu Yadav [Syncfusion]
Replied On July 19, 2017 09:39 AM

Hi Tommy,   
   
Thank you for using Syncfusion Products.   
   
The reported requirement “Get unselected items in SfListView” can be achieved by a workaround in sample level. In the sample, you can filter the SelectedItems and unselected items from the underlying collection like below code example.   
   
Code Example[C#]:   
private void listView_SelectionChanged(object sender, ItemSelectionChangedEventArgs e)   
{   
  var unselecteditems = new List<Contacts>();   
  var selecteditems = new List<Contacts>();   
  for (int i = 0; i < viewModel.contactsinfo.Count; i++)   
  {   
    var item = viewModel.contactsinfo[i];   
    if (listView.SelectedItems.Contains(item))   
        selecteditems.Add(item);   
    else   
        unselecteditems.Add(item);   
  }   
}   
  
    
Please let us know if you require further assistance.   
   
Regards,   
Dinesh Babu Yadav   
 


pumaprog
Replied On July 19, 2017 10:50 PM

Thank you Dinesh!  This put me on the right path.


Dinesh Babu Yadav [Syncfusion]
Replied On July 20, 2017 02:03 AM

Hi Tommy, 
 
Thank you for your valuable feedback. 
 
Regards, 
Dinesh Babu Yadav 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;