Assembly: WindowsBase (in windowsbase.dll)
'Declaration Public Sub CoerceValue ( _ dp As DependencyProperty _ ) 'Usage Dim instance As DependencyObject Dim dp As DependencyProperty instance.CoerceValue(dp)
The identifier for the dependency property to coerce.
The specified dp or its value were invalid or do not exist.
The CoerceValueCallback is also invoked internally whenever a property value is being re-evaluated.
When you invoke the CoerceValue method, you are ultimately invoking the coerce value callback for the property that you specify. Typically you will only invoke CoerceValue if you know that a coerce value callback exists, and if you know the callback's criterion for coercion.
The most common scenario for calling CoerceValue is within class handling or property change callbacks of related properties that influence each other's values in a dependent way.
The following example calls CoerceValue within a 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.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.