Wpf - notification of a change in the property value for the properties of an element of the structure

How to connect to a property change notification for FrameworkElement properties? We load xaml at runtime, and for each element in the visual tree we need to bind something in order to be notified of a change in the property value when someone ever changes the property value of an element.

What is the best way if it exists?

+5
source share
1 answer

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

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

All Articles