ItemsSource not updating correctly. Non-Telerik ListView updates just fine

2 posts, 0 answers
  1. Jon
    Jon avatar
    8 posts
    Member since:
    Aug 2015

    Posted 06 Apr Link to this post

    I am using a common ViewModel/Model/Services library that is shared between a WPF project and Xamarin Forms project.  

    When I retrieve a fresh list of a large number of items, I clear the items (derives from ObservableCollection) on the UI thread, then add a bunch of items to the collection NOT on the UI Thread, then call the following on the UI Thread:

    OnPropertyChanged(new PropertyChangedEventArgs("Count"));
    OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
    OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));

    For WPF and non_telerik ListView, this works great and I don't have to jam up the UI Thread with every single Add to the collection.  For the RadListView, this doesn't work and I end up with an empty list (from a view perspective).  Now, if I just call Add for every single item on the UI thread, the RadListView updates, but it jams up the UI thread and has a bad UX (you can see each item added being added visually).

    In the code behind, I even listened for any NotifyCollectionChangedAction.Reset events, and then remove and set the ItemsSource binding, and that doesn't work either.

    Any tips on getting this working without having to call Add on the UI thread for every item?  This is literally the only thing in the way from me 'shouting on the rooftops' why everyone should use Telerik Xamarin Forms controls.

  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 07 Apr Link to this post

    Hi Jon,

    Thank you for contacting us! I can confirm the issue regarding the Reset NotifyCollectionChanged action. We are considering it with high priority and will address it in our next official release scheduled for the beginning of May. Please excuse us for the inconvenience caused.

    Currently, I can offer you workaround involving extended Listivew renderers. Please have a look at the project attached and let us know if this help. 


    P.S. I have updated your telerik points accordingly.

    Regards,
    Tsvyatko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top