I’m sure I am missing some of the basics here so please bear with me.
I have a two objects, a SalesOrder and a SalesOrderLineItem. The lineitems are kept in an Observablecollection<SalesOrderLineItem> of SalesOrder, and if I add line items my databound listView knows about the new items.
Now where I am having a problem is here: The SalesOrder has a read only property called ‘OrderTotal’, which knows what the total price from all the line items combined are.
If I change the quantity, or price of a line item, I don’t seem to know how to get change notification to bubble up to ‘OrderTotal’.
Both classes inherit from, and fire INotifyPropertyChanged.
Wham am I missing?
The ObservableCollection only notifies when an Item is added, removed, or when the list is refreshed, not when a property of an Item within the collection changes.
The SalesOrder class needs to be listening to each SalesOrderLineItem’s PropertyChanged event.
–
The OrderTotal property could also be dynamic, generating the total each time…