Something like this (this will catch the changes in all instances of CustomCtrl ):
public static readonly DependencyProperty ProvaProperty = DependencyProperty.Register( "Prova", typeof(string), typeof(CustomCtrl), new PropertyMetadata( new PropertyChangedCallback(OnValueChanged) ) ); private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
If the "clients" of your CustomCtrl wanted to catch a change in this property for a specific instance, then they can use:
CustomCtrl instanceofsomecustomctrl = ....... DependencyPropertyDescriptor descr = DependencyPropertyDescriptor.FromProperty(CustomCtrl.ProvaProperty, typeof(CustomCtrl)); if (descr != null) { descr.AddValueChanged(instanceofsomecustomctrl, delegate {
source share