Wpf binding not updating propertychanged
In the demo, the rapidly changing data source is called Random Number Engine.
It has a public property named Current, which returns a random number. When the value changes, the Property Changed event is raised so that the binding system will attempt to push that new value into a Text Block in the UI.
Upon closer inspection I discovered that the object we were binding to was an delegate and you would think all is well.
You of course would be wrong, here is what happens when the Shopping Cart raises a property changed event.
However, if multiple properties bind to the same source, consider using the Data Context property.
The Data Context property provides a convenient way to establish a data scope.
The Text Block’s Text property is bound to the Current property on the Random Number Engine, and that binding is where we use the Update Threshold Converter to govern how often the data is pushed.
In the most typical scenario, your source object is the object that contains your data and your target object is a control that displays that data.
Essentially for our event to work we need the sender to be the shopping cart proxy and not the actual shopping cart.
To do this we will need to extend one of version, but I’ll leave that as an exercise for the reader.
NET Developer Group a few days ago, someone in the audience asked a question about the data binding system which piqued my interest.
He asked if it is possible to control how frequently a binding target is updated.