Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Bug: ListView crashes when deleting an item (workaround available)

$
0
0

I created a ListView in Xaml like this

    <ListView ItemsSource="{Binding ContactsGroupCollection}" ItemSelected="OnItemSelected" IsGroupingEnabled="true">

The item source is an ObservableCollection of ObservableCollection:

    public ObservableCollection<ContactsGroup> ContactsGroupCollection { get; set; }

    public class ContactsGroup : ObservableCollection<Contact>

The list will crash if I delete a Contact.

Solution: instead of setting IsGroupingEnabled="true" in Xaml, set it in the C# code behind file and it will work.

Related bug: ListView.GroupHeaderTemplate does not work in iOS 8, the same code works fine in iOS 7.1.


Viewing all articles
Browse latest Browse all 58056

Trending Articles