The ItemsSource
is always the same, a reference to your collection, no change, no update. You could null it out before:
dgOrderDetail.ItemsSource = null;
dgOrderDetail.ItemsSource = OrderDetailObjects;
Alternatively you could also just refresh the Items:
dgOrderDetail.ItemsSource = OrderDetailObjects; //Preferably do this somewhere else, not in the add method.
dgOrderDetail.Items.Refresh();
I do not think you actually want to call UpdateLayout
there...
(Refusing to use an ObservableCollection is not quite a good idea)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…