It is assumed that the property is of the correct type per the type registered with the property system, so checking type within the callbacks is not ordinarily done.
Public Shared Function Is Valid Reading(By Val value As Object) As Boolean Dim v As Double = CType(value, Double) Return ((Not v. A typical scenario for using a linkage of dependency properties is when you have a user interface driven property where the element holds one property each for the minimum and maximum value, and a third property for the actual or current value.
Here, if the maximum was adjusted in such a way that the current value exceeded the new maximum, you would want to coerce the current value to be no greater than the new maximum, and a similar relationship for minimum to current.
For instance, in the Min/Max/Current scenario, you could choose to have Minimum and Maximum be user settable.
If so, you might need to coerce that Maximum is always greater than Minimum and vice versa.
Validation callbacks can be assigned to a dependency property when you first register it.
The validation callback is not part of property metadata; it is a direct input of the Register method.
But if that coercion is active, and Maximum coerces to Minimum, it leaves Current in an unsettable state, because it is dependent on both and is constrained to the range between the values, which is zero.
Then, if Maximum or Minimum are adjusted, Current will seem to "follow" one of the values, because the desired value of Current is still stored and is attempting to reach the desired value as the constraints are loosened.
Validation callbacks specifically are intended to be class validators, not instance validators.
The parameters of the callback do not communicate a specific Dependency Object on which the properties to validate are set.
Application writers must be prepared to handle these exceptions.