i want to set UpdateSourceTrigger of the Binding of a PasswordBox to LostFocus or PropertyChanged dynamically.
Is there a way to bind UpdateSourceTrigger of a Binding to a DependencyProperty like this?
Password="{Binding Path=PasswordProperty, Mode=TwoWay, UpdateSourceTrigger={Binding UpdateSourceTriggerProperty}"
Kind Regards, Andy
You can't change the
UpdateSourceTriggerof an existing binding in the way you're attempting because, as Clemens points out, it is not a dependency property. Normally, you'd be able to accomplish this by using aStylewithDataTriggers that replace the entire binding, but in this case you can't do that either becausePasswordis also not a dependency property.This later point is an intentional design choice on Microsoft's part:
For more of an explanation you can take a look at this great answer from the question How to bind to a PasswordBox in MVVM.