Hi 78669366,
Welcome to our Microsoft Q&A platform!
You can enable ListView's "IsPullToRefreshEnabled" property to achieve item refreshing. And bind "LoadItemsCommand" to "RefreshCommand" and set "IsRefreshing".
The following the demo xaml.
<ListView x:Name="UpcomingJobsListView"
ItemsSource="{Binding UpcomingJobsList}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding LoadItemsCommand}"
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
RefreshControlColor="Red">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding Name}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Now you can use "Task.Run" to perform time-consuming operations and set "IsBusy" to false when the task is finished.
private void LoadUpcomingJobsAsync()
{
IsBusy = true;
Task.Run(() =>
{
//Load data from web api here
// time consuming operations here
}).ContinueWith((t) =>
{
IsBusy = false;
});
}
Regards,
Kyle
If the response is helpful, please click "Accept Answer" and upvote it.
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.