views:

117

answers:

1

Is there any way to force wpf to run the value converter again on a specific event?

+1  A: 

You can force WPF to update a binding by calling BindingExpression.UpdateTarget (and, for certain bindings, BindingExpression.UpdateSource). If the binding involves a converter, then the converter will run as part of that update.

To get the BindingExpression for a bound property, call BindingOperations.GetBindingExpression.

itowlson
Is there no way to do it from XAML like UpdateEvent=blablabla??
Petoj
No. WPF only knows about dependency properties and INotifyPropertyChanged on the source (data object) side, and dependency properties and focus events on the target (UI element) side. If you want to listen for a different event and force an update on that other event, you must do so in code. Sorry.
itowlson