Source updates caused by a property-modified event do not trigger a binding, and property-changing events that occur during a source-binding update are ignored.
Here is an easy way to demonstrate this. Create this class:
public class TestClass : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private int _Property; public int Property { get { return _Property; } set { if (value < 1000)
Now create a window containing two TextBox es whose Text bound to the Property property on the instance of this class. Make both options two-way binding, and UpdateSourceTrigger - PropertyChanged .
Whenever you enter a number in the limited string of a TextBox , another TextBox displays the next number. The binding of the first TextBox ignores the PropertyChanged event, which the source raises because this event occurs during the binding. The second text field is updated by the first PropertyChanged event, but it does not update the source with its new value.
If you update a property in code (for example, in a button click event), both TextBox es will display the same value - for example. if you set the property to 20, both will be displayed 21. An event with a property change is fired when the property is set to 20, the current value of 21 is displayed, and the bindings do not update the source.
Robert rossney
source share