This question is locked. New answers and comments are not allowed.
Greetings,
I'm having an issue with the TrackedBindingList: in the constructor of my view model I subscribe to the ListChanged event of my model's collection, in order to update a VM property representing a summary of the collection- let's say TotalCost = order.Products.Sum(p=> p.Cost). Since Product implements INotifyPropertyChanged I expect to be notified both when the collection changes(add/remove) and Product.Cost changes as well, so that I can update the summary. Simple enough- however it only works for Products that are inserted after subscribing to the event- deleting an existing product does trigger the event, however modifying the cost of a product that was already present in the collection does not.
Also as a bonus question I was wondering what would be the correct way for implementing a "reset" functionality? As soon as the OpenAccessContext is modified a 'Reset' button becomes visible- clicking it ClearsChanges, but how do I update the UI after? As a quick fix I made the topmost entity raise a OnPropertyChanged(string.Empty) but that only updates it's own fields- all navigational properties(my TrackedBindingLists) stay silent- so the item-cost from before is not reverted(on the UI).
I'm having an issue with the TrackedBindingList: in the constructor of my view model I subscribe to the ListChanged event of my model's collection, in order to update a VM property representing a summary of the collection- let's say TotalCost = order.Products.Sum(p=> p.Cost). Since Product implements INotifyPropertyChanged I expect to be notified both when the collection changes(add/remove) and Product.Cost changes as well, so that I can update the summary. Simple enough- however it only works for Products that are inserted after subscribing to the event- deleting an existing product does trigger the event, however modifying the cost of a product that was already present in the collection does not.
Also as a bonus question I was wondering what would be the correct way for implementing a "reset" functionality? As soon as the OpenAccessContext is modified a 'Reset' button becomes visible- clicking it ClearsChanges, but how do I update the UI after? As a quick fix I made the topmost entity raise a OnPropertyChanged(string.Empty) but that only updates it's own fields- all navigational properties(my TrackedBindingLists) stay silent- so the item-cost from before is not reverted(on the UI).