Articles in this section
Category / Section

How to disable selection for particular items in SfListView?

2 mins read

SfListView allows you to disable selection for a particular set of items based on the provided conditions in SelectionChanging event of SfListView. Get the tapped item data from the IList AddedItem of ItemSelectionChangingEventArgs using which you can check whether it satisfies the condition and disable the selection through Cancel property as like below code example.

 

C#

public partial class MainPage : ContentPage
{
  public MainPage()
  {
    InitializeComponent();
  }
 
  private void listView_SelectionChanging(object sender, Syncfusion.ListView.XForms.ItemSelectionChangingEventArgs e)
{
  if (e.AddedItems.Count > 0 && (e.AddedItems[0] as Contacts).Category == "Non-Selectable items")
      e.Cancel = true;
  }
}

 

Click here to download the sample.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied