Quantcast
Viewing all articles
Browse latest Browse all 77050

ListView items bindings visually not updated when property changes

Hi,

I'm having an issue with my ListView items in Xamarin.Forms 1.4.4 (same problem with 1.4.2, 1.4.3, and 1.5.0 pre3).

In my XAML ItemTemplate I have :

The IsSelected property comes from this class :

public class ListViewItem : IListViewItem, INotifyPropertyChanged
{
private bool isSelected;
public bool IsSelected
{
get { return isSelected; }
set { isSelected = value; NotifyPropertyChanged(); }
}

    private T content;
    public T Content 
    {
        get { return content; }
        set { content = value; NotifyPropertyChanged(); }
    }


    public ListViewItem (T content)
    {
        Content = content;
    }


    #region INotifyPropertyChanged implementation

    public event PropertyChangedEventHandler PropertyChanged;
    private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
    {
        if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion
}

When i change the IsSelected property to true in my code, it is sometimes not updated visually in the UI.

When i scroll down the list view and i scroll up again, sometimes, the UI is properly updated (because of Cells recycling ?).

Is there someone facing the same issue ?

Thanks a lot,
Have a nice day !


Viewing all articles
Browse latest Browse all 77050

Trending Articles