
This is quite easy in WPF:
// get the property descriptor
DependencyPropertyDescriptor prop = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, myTextBox.GetType());
// add change handler
prop.AddValueChanged(myTextBox, (sender, args) =>
{
});
prop.AddValueChanged(myTextBox, (sender, args) =>
{
});
Unfortunately Silverlight has a limited set of meta-data functionality around the dependency property system, because the DependencyPropertyDescriptor does exist in Silverlight.
In order to get a workaround I found a solution in which I get notified with help of the binding system. I simple use a relay object which value property is bound to the source property I want to get notified. The relay object contains a public event which raises when the value changes.
Read more: Kiener's Blog
In order to get a workaround I found a solution in which I get notified with help of the binding system. I simple use a relay object which value property is bound to the source property I want to get notified. The relay object contains a public event which raises when the value changes.
Read more: Kiener's Blog