This question is locked. New answers and comments are not allowed.
I'm using the databound listbox to load some items and I'm also using the OnDemandAutomatic DataVirtualization Mode, but I can't get it work.
In my project when the page loads I use a method to bind a List<Item> with the databound listbox, I have subscribed to them OnDataRequested and below is my code for it
In my project when the page loads I use a method to bind a List<Item> with the databound listbox, I have subscribed to them OnDataRequested and below is my code for it
void resultsLbox2_DataRequested(object sender, EventArgs e){ if (actorPagesUsed < actorPages) { actorPagesUsed++; tmdbAPI.SearchPerson(searchBox2.Text, actorPagesUsed, null, result => { if (result.Data.results.Count == 0) resultsLbox2.DataVirtualizationMode = DataVirtualizationMode.None; else { foreach (PersonResult pr in result.Data.results) { Actor act = new Actor(); if (!string.IsNullOrEmpty(pr.profile_path)) { act.ID = pr.id; act.Name = pr.name; act.Image = new BitmapImage(new Uri(API.TMDBPrefixW185 + pr.profile_path)); actorsResults.Add(act); resultsLbox2.ItemsSource = null; resultsLbox2.ItemsSource = actorsResults; } } } }); }}
the SearchPerson is an async method and inside of it is the callback, as you can see I kind of filter the returned items,
add them to the first List<item> I have binded, set the itemssource to null and then bind it again but it doesn't work?
what am i doing wrong here?