79483723

Date: 2025-03-04 12:42:11
Score: 0.5
Natty:
Report link

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!

Reasons:
  • Whitelisted phrase (-1): Hope that helps
  • RegEx Blacklisted phrase (2): encontrado
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: CiberBoy