Posted 23 October 2017, 12:32 pm EST
Hi
Maybe i’m not getting something, but i have a CollectionView being used with an ObservableCollection
This CollectionView gets applied a series of filters to show the information and i want to have a Label with the Sum of certain column. Everytime a filter is applied to the Collection, the column will update with its current Sum
That’s where the problems occurs, i’m subscribing to the collection FilterChanged event and inside i calculate the sum as follows:
Totals = CollectionView.Sum(x => ((InventoryItem)x).Qty);
But it seems that i’m always getting the sum of the “previous” filter condition…
Example:
I have 3 filters to apply (inside a Picker), everytime i pick one, a filter applies… the first time the sum fires, it is getting the sum of ALL the items in the collection (it is not taking only the filtered ones)… so if i change the filter again, now the Sum shows the previous filter…
I don’t know if i’m explaining myself correctly, and i do not know if it is an issue with my code or with the CollectionView, o maybe there is other what of getting the current value or sum of what the CollectionView is showing at the moment