6

How to hook to the property value change notification for properties of a FrameworkElement? We are loading xaml at run time, and for each element in the visual tree, we need to hook up something to receive a property value change notification, when ever some one changes a property value of the element.

What is the best way, if one exists?

1 Answer 1

6

If you want to be notified when the value of a dependency property changed, you can do that (case of the Tag property) :

DependencyPropertyDescriptor desc = DependencyPropertyDescriptor.FromProperty(FrameworkElement.TagProperty, typeof(FrameworkElement));
desc.AddValueChanged(someObject, someEventHandler);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.