Performance improvement while loading a collection View

Manickam, Suraj 220 Reputation points

Hi , I have to load a collection that has a huge data , I use async task to fetch the data from service and use loading indicator till then , when I navigate to the response screen , it takes a bit of time to populate the collection view which makes the user to see the main screen without the loading indicator ! How can I make the user see the loading indicator until the page is ready to be loaded?

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,845 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,176 Reputation points Microsoft Vendor


    For your layout, you can set ActivityIndicator's IsVisible="true" and set the Collectionview's IsVisible="false"

    <ActivityIndicator VerticalOptions="Center" HorizontalOptions="Center" x:Name="myActivityIndicator" IsVisible="true" IsRunning="true" />
      <CollectionView x:Name="myCollectionview" >

    Then, you can load the data in the OnAppearing method. I use a Task.Delay to simulate loading data. when Task is finished, We can set myCollectionview.IsVisible = true; and hide the ActivityIndicator by myActivityIndicator.IsVisible = false;

    protected override 
       myCollectionview.IsVisible = false;
           MainThread.BeginInvokeOnMainThread(() => {
               myCollectionview.IsVisible = true;
                myActivityIndicator.IsVisible = false;

    Best Regards, Leon Lu

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.