This is a migrated thread and some comments may be shown as answers.

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

1 Answer 188 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 06 Apr 2016, 03:20 PM

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.

1 Answer, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 07 Apr 2016, 02:08 PM
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
Tags
ListView
Asked by
Jon
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Share this question
or