DependencyProperty.ValidateValueCallback 属性

定义

获取依赖项对象的值验证回调。Gets the value validation callback for the dependency property.

public:
 property System::Windows::ValidateValueCallback ^ ValidateValueCallback { System::Windows::ValidateValueCallback ^ get(); };
public System.Windows.ValidateValueCallback ValidateValueCallback { get; }
member this.ValidateValueCallback : System.Windows.ValidateValueCallback
Public ReadOnly Property ValidateValueCallback As ValidateValueCallback

属性值

最初依赖项对象注册时为 validateValueCallback 参数提供的该依赖项对象的值验证回调。The value validation callback for this dependency property, as provided for the validateValueCallback parameter in the original dependency property registration.

注解

此属性将包含任何没有注册验证回调的依赖属性 nullThis property will contain null for any dependency property with no registered validation callback.

验证值回调必须以静态意义进行操作:通过 ValidateValueCallback 应用的验证无法确定所提供的值是否对任何特定实例有效。Validate value callbacks must act in a static sense: validation applied through the ValidateValueCallback cannot determine whether the provided value is valid for any particular instance. 回调只能确定具有依赖项属性的所有对象是否应接受提供的值为有效的。The callback can only determine whether all objects that possess the dependency property should or should not accept the provided value as valid. 如果需要执行的验证依赖于在特定实例上了解其他依赖项属性的值,请改用 CoerceValueCallbackIf you need to perform validation that relies on knowing the values of other dependency properties on a particular instance, use a CoerceValueCallback instead. CoerceValueCallback 注册为依赖属性元数据的一部分,而不是直接在依赖属性标识符中进行注册。The CoerceValueCallback is registered as part of dependency property metadata, rather than directly within the dependency property identifier. 有关详细信息,请参阅依赖属性回调和验证For details, see Dependency Property Callbacks and Validation.

适用于

另请参阅