Sunday, July 3, 2011

WPF Tip : Dependency Property changed callback not getting called

If you have a dependecy property of type IEnumerable databound to an INPC property simply raising a propertychanged event in the INPC property will not cause the changed callback of the dependency property to get called.

This is because apparently WPF internally uses an optimization where it checks the equality before calling the callback mentioned in the dependency property metadata. 

To force this callback you can assign the a new Enumerable instance to the INPC property.