ChangeTracking: ListView in Xamarin.Forms doesn't refresh when the underlying collection is updated!

Hi,

public class MyOrder 
{
	public Order Order { get; set; }
	
	public MyOrder()
	{
		var _iniOrder = new Order(); 		//class that you use
		Order = _iniOrder.AsTrackable();
	}
}

XAML:

<ListView ItemsSource="{Binding MyOrder.Order.OrderDetails}" .../>

Adding item

public MyOrder Mo { get;set; }
Mo = new MyOrder();
...
Mo.Order.OrderDetails.Insert(0, new OrderDetail
{
	ItemNo = Guid.NewGuid().ToString(),
	OrderDetailId = new Random().Next(1, 100)
});	

ListView does not refresh when the underlying collection is updated(ie: Mo.Order.OrderDetails):

even the collection has data!

FYI : The code above works fine in wpf but doesn’t work for Xamarin.Forms(Android/UWP)!

xf-android

wpf

is there an explanation? thanks in advance and thanks for sharing this!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

Sorry but I have never used Xamarin Forms, I don’t know how their Binding system works.