Xamarin ObservableCollection

-1

Hello

I'm using Xamarin and when I want to load and display a list of objects on the screen I use ObservableCollection to make the page load only after the content is loaded. But in one of the WebService returns I get only one string.

What property do I use to load content before loading the page with just a string?

    
asked by anonymous 04.05.2018 / 15:54

1 answer

0

Dude, your question is kind of confusing, but as far as I understand you want to load a list on a page.

The ObservableCollection is a list that issues a notification when it is changed, that is, when it is working with a listView and you use an ObservableCollection as the data source, it means that when you insert an object in this list, the ObservableCollection will launch a notification and your ListView will update with the new object.

In your case, as far as I understand, you want to load the page only when the ListView is populated. To do this is just fill the list in the screen builder, but it is not a good practice, because if the list is large, it may take a while to open the screen, so the application gets stuck.

I would advise you to use paging in your list and initially populate it in the OnApearing method as it runs when your view appears. Remembering to use Async methods, as this will prevent processing from occurring on the main Thread, thus causing a crash experienced for the user.

    
04.05.2018 / 16:13