Reputation: 1
I add data on list view but i need to close the program first to show the data. what should i add to auto refresh the content page.
Class
public class Cart : BindableObject
{
public string product_id { get; set; }
public string name { get; set; }
public string price { get; set; }
public string image { get; set; }
public string quantity { get; set; }
}
Upvotes: 0
Views: 386
Reputation: 12723
If the ViewModel uses ObservableCollection to create the Cart list, then the ListView will update when adding data on runtime.
For example:
public ObservableCollection<Cart > CartItems { set; get; }
CartItems.Add(new Cart(){...})
Upvotes: 1