#133 – Where a Dependency Property Gets Its Value

Since the value of a dependency property can come from a variety of different sources, WPF uses a predetermined precedence for each possible source of a property value in order to determine the final value.

WPF determines the final value for a dependency property as follows:

  • Determine the base value, using the precedence rules listed below
  • Evaluate expressions
  • Apply animations
  • Coerce value¬† (implementing class might coerce to valid value)
  • Validate (implementing class may throw exception if value is invalid)

The base value of a property is obtained from one of the following sources, listed from highest to lowest precedence:

WPF works down the list until it finds a source that provides a value for the property.