I have a changing collection of changing objects(add/delete in Collection as well as property changes are also possible).
I want to get a new collection by some calculation on this Collection (summation / multiplication over some fields of all the objects having same value of a field). And bind calculated list to UI.
for Ex: So I have a list of rate and qty of different qualities of several fruits and now I want to find a new list having avg rate and total quantity of each fruit(irrespective of quality) given that rate & quantity can be changes at run time as well as some more qualities and fruit-species can be added to collection.
Now If rates or quantity changes at runtime in first List changes should be reflected in second list also.
Please suggest which methods should be used to achieve it considering we are binding the list to a Datagrid.
There is a neat Reactive Extension called Buffer:
This will allow you to receive on collection changed events as they occur, but ignore all except the last one.
UPDATE 1
It is a known issue that
CollectionChanged
does not fire when items are updated. The MSDN documentation is simply incorrect. You will have to implement aTrulyObservableCollection
but your data elements must implementINotifyChanged
interface as well.