Hello,
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" >
...
</CollectionView>
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
{
base.OnAppearing();
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.