WPF: XAML property declarations not being set via Setters?

前端 未结 1 1328
长发绾君心
长发绾君心 2020-11-28 15:18

I have a WPF application where I\'m using dependency properties in codebehind which I want to set via XAML declarations.

e.g.



        
相关标签:
1条回答
  • 2020-11-28 16:05

    The "CLR-wrappers" for dependency properties only get called when done through code. XAML depends on the name specified in the DependencyProperty.Register(...) call. So, instead of "extending" the logic of the setter for your dependency property like you did above, just put your custom logic in a PropertyChangedCallback function.

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