我正在與 Xamarin 一起開發。當我滾動 CollectionView 時,即使滾動完成,等待標記影片也不會消失。請告訴我如何洗掉它。

<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>
uj5u.com熱心網友回復:
當您完成重繪 命令中的任務時,您需要將 IsBusy 設定為 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;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/428105.html
