#145 – Dependency Property Value Sources: #11 – Default Value

The eleventh source in the list of sources for the base value of a dependency property is the default value.  A dependency property may define a default value that will become the property’s value if no mechanism with higher precedence assigns a value.

As an example, notice that the value of the Opacity property for most controls inheriting from UIElement (e.g. Button or Label) has a value of 1.0 if you don’t set it to anything else.  This is the default value for the UIElement.Opacity property, specified in its metadata.

Advertisement