WPF dependency property setter not firing when PropertyChanged is fired, but source value is not changed

后端 未结 1 1211
小鲜肉
小鲜肉 2020-12-19 12:18

I have an int dependency property on my custom Textbox, which holds a backing value. It is bound to an int? property on the DataContext.

If I raise the PropertyChan

相关标签:
1条回答
  • 2020-12-19 13:14

    The XAML will call SetValue directly, instead of calling your property setter. I can't remember exactly the specifics, but I ran into a similar problem a while ago. You should not put any logic in the setter for Value, instead define a callback for when the Dependency Property changes, and update the value from there.

    0 讨论(0)
提交回复
热议问题