Home > Software engineering >  the wait mark animation does not disappear on Xamarin.Forms
the wait mark animation does not disappear on Xamarin.Forms

Time:02-19

I am developing with Xamarin. When I scroll a CollectionView, the wait mark animation does not disappear even after the scrolling is finished. Please tell me how to remove it.

enter image description here

        <StackLayout Spacing="20" Padding="15" >
            <RefreshView x:DataType="local:ItemDetailViewModel" 
                 IsRefreshing="{Binding IsBusy, Mode=TwoWay}">
                <CollectionView x:Name="ItemsListView" 
                 ItemsSource="{Binding EventItems}" SelectionMode="None">

...template...

                </CollectionView>
            </RefreshView>

        </StackLayout>

CodePudding user response:

When you finish the task inside the refresh command you need to IsBusy to False.

<RefreshView IsRefreshing="{Binding IsBusy}"
             Command="{Binding RefreshCommand}">
    
</RefreshView>
public ICommand RefreshCommand { get; }
public ItemsViewModel()
{
    Title = "Browse";
    Items = new ObservableCollection();
    RefreshCommand = new Command(ExecuteRefreshCommand);
}

bool _isBusy;
public bool IsBusy
{
    get => _isBusy;
    set
    {
        _isBusy = value;
        OnPropertyChanged(nameof(IsBusy));
    }
}

void ExecuteRefreshCommand()
{
     // DO your task then
    // Stop refreshing
    IsBusy = false;
}
  • Related