OneWay binding for ToggleButton's IsChecked property in WPF

后端 未结 3 1960
一向
一向 2021-02-15 08:05

I have a ToggleButton with its IsChecked property bound to a property using a OneWay binding.



        
3条回答
  •  眼角桃花
    2021-02-15 08:52

    This is by design when using oneway data binding. Add the attached property PresentationTraceSources.TraceLevel=High to your binding and you will see when it gets disconnected. This link describes the problem as well (without offering any solution): Debugging Data Binding in WPF

    The way I normally solve it is to use a command for user interaction and code behind to change the control appearance because of some changed properties.

提交回复
热议问题