DependencyObject::CoerceValue Method (DependencyProperty^)
Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.
Assembly: WindowsBase (in WindowsBase.dll)
The specified dp or its value were invalid or do not exist.
In addition to being explicitly invoked through calling CoerceValueCallback for a dependency property is also invoked internally whenever the dependency property value is being re-evaluated by the WPF property system., the
When you invoke themethod, you are ultimately invoking the coerce value callback for the property that you specify. Typically you will invoke only if you know that a coerce value callback exists, and if you know the callback's criteria for coercion.
The most common scenario for calling Dependency Property Callbacks and Validation.is within class handling or property change callbacks of related properties that influence each other's values in a dependent way. For more information, see
The following example calls PropertyChangedCallback implementation that is used as the PropertyChangedCallback for a different dependency properties on the same class. This is a common pattern for introducing true value dependencies between dependency properties.within a
Available since 3.0