It looks like your EmptyViewTemplate is not updating properly because CollectionView does not react to changes in IsLoading. The EmptyViewTemplate only appears when News is empty, and it does not update dynamically unless News itself changes. So update the XAML. Instead of EmptyViewTemplate, set the EmptyView dynamically:
<CollectionView ItemsSource="{Binding News}"
EmptyView="{Binding EmptyViewMessage}">
</CollectionView>
Also modify your view model
private string _emptyViewMessage;
public string EmptyViewMessage
{
get => _emptyViewMessage;
set
{
_emptyViewMessage = value;
OnPropertyChanged();
}
}
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;
OnPropertyChanged();
UpdateEmptyViewMessage();
}
}
private void updateemptyview()
{
if (IsLoading)
EmptyViewMessage = "Loading...";
else if (Status == ConstantsFile.STATE_NOT_FOUND)
EmptyViewMessage = "No se han encontrado coincidencias.";
else if (Status == ConstantsFile.STATE_SERVER_ERROR)
EmptyViewMessage = "Ups.. Parece que algo no ha ido como deberÃa.";
else
EmptyViewMessage = string.Empty;
}
Hope that helps!