Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This is valuable information on hooking into DP system of WPF.
The answer is DependencyPropertyDescriptor. This is similar to PropertyDescriptor from WinForm.
For example, if you want to get notification whenever a property change but you don't own the code and you don't derive from the class and it does not expose SomethingChanged event. How can you get notification.
DependencyPropertyDescriptor dpDes = DependencyPropertyDescriptor.FromProperty(Control.BackgroundProperty);
dpDes.AddValueChanged(myElement, myEventHandler);
So whenever someone do a SetValue/ResetValue/ClearValue on myElement.Background, myEventHandler will be raised. When you are done listening to change notification, you can do RemoveValueChanged(..) to unsubscribe.
BenCon was talking about this as well :-)