我遇到了问题Binding
。依赖属性与转换器绑定Rectangle.Fill
到一个。ObservableCollection
虽然ObservableCollection
implements INotifyCollectionChanged
,绑定没有更新。但是,我设法通过将我的委托附加到集合的更改通知事件并手动刷新绑定来解决这个问题:
void ColorsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
BindingExpression b = colorRectangle.GetBindingExpression(Rectangle.FillProperty);
if (b != null)
b.UpdateTarget();
}
但是,最近,我将 更改Binding
为MultiBinding
,并且上述解决方案停止工作(即b
is null
)。有没有办法强制Multibinding
更新目标属性?
最好的问候——幽灵。