PropertyMetadata.CreateDefaultValueCallback Property


Gets a reference to the callback method that provides a default property value.

 property CreateDefaultValueCallback ^ CreateDefaultValueCallback { CreateDefaultValueCallback ^ get(); };
CreateDefaultValueCallback CreateDefaultValueCallback();
public CreateDefaultValueCallback CreateDefaultValueCallback { get; }
var createDefaultValueCallback = propertyMetadata.createDefaultValueCallback;
Public ReadOnly Property CreateDefaultValueCallback As CreateDefaultValueCallback

Property Value

A reference to the callback method that provides a default property value.


Use a CreateDefaultValueCallback instead of a fixed constant default value in any case where the default value of a dependency property might be thread-bound. The CreateDefaultValueCallback becomes a factory for default values whenever there is a need to get default values of properties on threads other than the main UI thread.

In order to establish a CreateDefaultValueCallback pattern for a dependency property, use one of the static Create methods instead of using the PropertyMetadata constructor when you define the metadata for the property. That metadata is submitted to the Register call. For more info, see Custom dependency properties. As with a property-changed callback, the CreateDefaultValueCallback method should be a static method of the type that registers the dependency property. The method does not have to be public.

Applies to

See also