figursagsmats
figursagsmats

Reputation: 175

What invokes the Property-changed callback of DependencyProperty in UWP?

The documentation for DependencyProperty in UWP states that the Property-changed callback is invoked when "the system has determined that there is an effective property value change". Can anybody tell me more specifically when this is?

For example it seems as if the callback is not invoked if a property of a DependencyProperty-instance is changed, even if I implement INotifyPropertyChanged on that property.

I know there is a similar question but that one is about the WPF dependencyProperty which is not the same thing.

Upvotes: 1

Views: 427

Answers (1)

mm8
mm8

Reputation: 169360

Can anybody tell me more specifically when this is?

Whenever the dependency property is set to a new value, whether it's as a result of some data binding, animation, style or something else.

For example it seems as if the callback is not invoked if a property of a DependencyProperty-instance is changed, even if I implement INotifyPropertyChanged on that property.

INotifyPropertyChanged has nothing to do with dependency properties. Dependency properties are defined in classes that inherit from DependencyObject. These are typically controls or other kinds of UI elements.

The INotifyPropertyChanged interface is typically implemented in view model classes that need to raise change notifications to the view, and that don't inherit from some specific framework class.

Upvotes: 1

Related Questions