开发者

WPF - Reevaluate OneWay Binding

开发者 https://www.devze.com 2023-01-09 03:27 出处:网络
I have a control whose bindin开发者_如何转开发g is set as OneWay. How can I force the value to be re-evaluated in code?Get the binding expression and call UpdateTarget:

I have a control whose bindin开发者_如何转开发g is set as OneWay.

How can I force the value to be re-evaluated in code?


Get the binding expression and call UpdateTarget:

BindingExpression binding = Control.GetBindingExpression(TextBox.TextProperty)
binding.UpdateTarget()

Of course, if you implement the INotifyPropertyChanged interface on the class that holds the source property for your binding then WPF will handle the updating for you automatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号