0
votes

I want to enable selection just for specific item but i don't know how i can do this. I try with ItemTemplateSelector but we don't have the great attribute in listviewitem. I try with selectionChangEevent but it's doesn't work when we use SelectionMode multiple or extended.

I have a listview with SelectionMode extended and for select item i use swipe gesture with isSwipeEnable true.I want for all items with status "BAD" for example disable swipe selection but click on item for show detailview work.

Regards.

1
bind isSwipeEnable to a property that return false if status equals "BAD" and return true for other condition? - har07
ListViewItem don't have the property isSwipeEnable - MatDev8

1 Answers

0
votes

My solution =>

private void ItemList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
   foreach (var item in e.AddedItems)
     {
       if (!item.IsBad())
       {
         ItemList.SelectedItems.Remove(item);
       }
       else
       {
         isBadAdd = true;
       }
     }
}

This code remove selectedItem in selectedItems if he isn't a bad item. But this solution don't remove the swipe enable on the item.