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

ListView refresh problems

$
0
0

Since last update I'm having some problems with listview refreshing.

In some parts I use observable collections, these work flawless, but in others I use lists because the data changes integrally and there is where I'm having problems.

Y have something like this:

List<DataObject> items = new List<DataObject>();

void UpdateData(DataObject[] NewItems)
{

    listView.ItemsSource = null;
    items.Clear();
    items.AddRange(Newitems);
    listView.ItemsSource = items;
}

This code just fails, if the list had no items and the NewItems only has one item it does not refresh at all. I semi-solved it refreshing the ItemTemplate like this:

var template = listView.ItemTemplate;
listView.ItemTemplate = null;
listView.ItemTemplate = template;

But this fails some times, nearly works, but not always.

Is someone having these problems? Any workaround known?

Cheers.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>