I'm having constant problem whenever I try to load ListView's ItemsSource in background thread, i.e. using Task.Run();
In the subclass of ListView:
ItemTemplate = new DataTemplate (typeof(ProductItemCell));
Task.Run (() => {// Comment this line and the last line, ListView's ViewCell "ProductItemCell" gets populated without any problem. Uncomment leads
// to the unpopulated ViewCell
// Here do a join query to get data from database
List<Product> prods = (List<Product>)ProductTable.Instance.GetItems(cateId);
List<ProductImages> prodImgs = (List<ProductImages>)ProductImagesTable.Instance.GetProductImagesOneForEachSku(prods);
ItemsSource = prods.Join(
prodImgs,
prod => prod.Sku,
prodImg => prodImg.Sku,
(prod, prodImg) =>
new ProductImageProductJoinMemory(prod, prodImg)
);
ItemTemplate.CreateContent ();
//});