Hi, I need to create a dependency property on a custom control. The problem is that the propertyChangedCallback does not get called when the collection changes. How should I properly handle this scenario?
I am afraid of memory leaks caused by simply event hooking to the CollectionChanged event during the initial property change (when the observable collection is assigned to the dependency property).
In other words, I need to create another property like ItemsControl.ItemsSource.
I've looked to the source of ItemsControl.ItemsSource using Reflector. Internally it uses WeakCollectionChangedListener which is internal class. I probably could copy its source and make use of it but i believe there must be another (better) solution.