Cannot bind DependencyProperty of type IList from both XAML and Setter

北慕城南 提交于 2020-01-11 12:50:29

问题


After implementing the propsed code from here:

Cannot bind ObservableCollection to List dp from xaml

I found out that if I had several instances of the control in the same page, the IList recieved all the values given to all the controls. I read online that in order to solve this, one must write:

SetValue(...) in the constructor.

This causes the Setter that is shown in above link not to work. (I guess that is because this time we need the IList to be static and not per-instance).

Please help! Thanks


回答1:


Use SetCurrentValue instead of SetValue.



来源:https://stackoverflow.com/questions/17007491/cannot-bind-dependencyproperty-of-type-ilist-from-both-xaml-and-setter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!