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

Get the unselected items from sfListView

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?  

3 Replies

DB Dinesh Babu Yadav Syncfusion Team July 19, 2017 01:39 PM UTC

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))   
Please let us know if you require further assistance.   
Dinesh Babu Yadav   

PU pumaprog July 20, 2017 02:50 AM UTC

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

DB Dinesh Babu Yadav Syncfusion Team July 20, 2017 06:03 AM UTC

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

Live Chat Icon For mobile
Up arrow icon