<TextBlock Name="txtName" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
"Name" is the property of an object which is bound with the TextBlock at runtime. I have implemented INotifyPropertyChanged so the code is working fine. My question is: if I replace PropertyChanged to Default will it still work? What's the difference between them?
According to MSDN, the UpdateSourceTrigger
's default value is PropertyChanged
for most properties and LostFocus
for the TextBox.Text
property.
In your case, you're probably binding to a property for which the default is already set to PropertyChanged
, so you won't see any difference.
PropertyChanged
is telling Binding
that whenever you receive PropertyChanged
notification for that property, update it's value on destination.
For some controls, like TextBox
, using Default
, it only updates binding destination when for example, it loses focus. When you set UpdateTrigger='PropertyChanged'
on it, it will update binding destination while you are typing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With