我声明了两个依赖属性: 首先,Color 类型的 FilterColor 和 Brush 类型的第二个 FilterBrush。 当 FilterBrush.Color 属性发生变化时,我需要更新 FilterColor 的值,当 FilterColor 属性发生变化时,我需要更新 FilterBrush.Color 的值。 我如何实现它?
最佳答案
使用 TwoWay 绑定(bind)绑定(bind)您的两个属性,如果您在 UI 中更改一个属性,则在属性 setter 中更改另一个属性,反之亦然,并使用 INotifyPropertyChanged 通知您的 UI 属性已更改。
关于c# - 在 WPF 中绑定(bind)两个依赖属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7694514/