Windows Dev Center

PropertyMetadata Constructor (Object)

Initializes a new instance of the PropertyMetadata class, using a property default value.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public PropertyMetadata(
	Object defaultValue


Type: System.Object
A default value for the property where this PropertyMetadata is applied.

The defaultValue for the PropertyMetadata specified as typeMetadata must be able to be typed as the type parameter, when you call Register or RegisterAttached to register a dependency property. A mismatch of types will not be noted at the time of registration, and will instead produce a run-time exception in type initialization for an instance of the owning type.

Because of the function of the Windows Phone property system, the apparent value of a property (even if not locally set) is not always the default value as registered with a property's metadata.

Do not use the value UnsetValue as the default value for a custom dependency property. UnsetValue is reserved for use as a sentinel value that participates in dependency property precedence determination.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2015 Microsoft