Xamarin Observablecollection

Asked

Viewed 111 times

0

Hello!

I am using Xamarin and when I want to load and display on the screen a list of objects 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 the content before loading the page with only one string?

  • 1

    Ideally you would add one example than has already tried and indicate the problem who is having.

1 answer

0

Dude, your question is a little fuzzy, but from what I understand you want to upload a list to a page.

The Observablecollection is a list that sends a notification when it is changed, i.e., when you are working with a listview and you use an Observablecollection as a data source, it means that when you enter an object in this list, Observablecollection will release a notification and its Listview will update with the new object.

In your case, as I understand it, you want to upload the page only when Listview is filled. To do this just fill the list in the screen builder, but it is not a good practice, because if the list is large, it may take time to open the screen, with this, the application gets stuck.

I would advise you to use pagination in your list and fill it initially in the Onapearing method, as it runs when your view appears. Remembering to use Async methods, as this way you prevent the processing from taking place in the main thread, thus causing a locked experience for the user .

  • I don’t think I was able to express myself well, but I was able to solve it. I was receiving the data from Viewmodel in the file builder . Cs from View. I just put the Viewmodel return on Onappearing() and it worked. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.