IList does not update UWP ListView #1883


#1

Actually Realm.Net (C#/UWP/Windows 10 Desktop)

I raised an issue but figured I would post this on the forum to see if anyone can solve this…

I am just converting and app from C#/WPF to C#/UWP (Windows 10) and it seems that IList does not update the UWP ListView.

So first question - should it ?

and if not then how should I bind the IList property to ensure the ListView will update if items are added or removed?

Maybe some more context - new items are getting created on a background thread - and the exact same method/code seems to work fine with C#/WPF.


<ListView x:Name="siteListView"  SelectionChanged="SiteListView_SelectionChanged" 
                             DataContext="{x:Bind _this}" 
ItemsSource="{x:Bind Customer.items, Mode=OneWay}"  >
...
public class Customer : RealmObject
    {
        [PrimaryKey]
        public string id { get; set; } = Guid.NewGuid().ToString();
        public string name { get; set; }

        public string address { get; set; }

        public string contact { get; set; }

        public float complianceScore { get; set; }
        public string completionStatus { get; set; }

        public IList<Site> sites { get; }

}

#2

The issue is caused by a decision we made to work around a Xamarin.Android bug. You can read more about it in this comment: https://github.com/realm/realm-dotnet/issues/1759#issuecomment-407749262