Property Changed in DependencyProperty

后端 未结 4 857
臣服心动
臣服心动 2020-12-07 04:37

In a previous post I asked how to register a property as DependencyProperty. I got an answer and it works fine.

But now I want to add some Items to this DependencyP

4条回答
  •  离开以前
    2020-12-07 04:53

    Sorry but this won't work as you've detected yourself. The DependencyProperty changed handler does fire only, if the value of the property changes, but in your case it doesn't, as the object reference is still the same. You have to register on the CollectionChanged eventhandler of the provided collection. (this you can do in the propertychanged handler from the dependencyproperty)

提交回复
热议问题