0
最初RadBusyIndicatior正在運行,但是當DoRefresh()調用並且Data已經更新時,RadBusyIndicatior仍在運行,我試過兩種綁定方式,但是沒有運氣。Telerik RadBusyIndicator沒有從MVVM更新ViewModel
請讓我知道我做錯了什麼。一旦數據被加載,我只想禁用RadBusyIndicator。
的XAML:
<telerikPrimitives:RadBusyIndicator Name="loading" IsRunning="{Binding ShowLoading}" Visibility="Visible" />
視圖模型代碼:
public class NewReleaseViewModel : ViewModelBase
{
public ObservableCollection<NewRelease> NewReleases { get; set; }
public NewReleaseViewModel()
{
NewReleases = new ObservableCollection<NewRelease>();
showLoading = true;
}
private bool showLoading;
public bool ShowLoading
{
get { return showLoading; }
set { showLoading = value;
Set<bool>(ref showLoading, value); }
}
private RelayCommand _refresh;
public RelayCommand Refresh
{
get
{
return _refresh ?? (_refresh = new RelayCommand(async() =>
{
try
{
await DoRefresh();
ShowLoading = false;
}
finally
{
ShowLoading = false;
}
}));
}
}