Validation.ErrorTemplate 附加属性

定义

获取或设置用于在装饰器层上生成验证错误反馈的 ControlTemplateGets or sets the ControlTemplate used to generate validation error feedback on the adorner layer.

see GetErrorTemplate, and SetErrorTemplate
see GetErrorTemplate, and SetErrorTemplate
see GetErrorTemplate, and SetErrorTemplate

注解

WPFWPF数据绑定模型允许您将 ValidationRules 与您的对象相关联 BindingThe WPFWPF data binding model allows you to associate ValidationRules with your Binding object. 如果用户输入的值无效,你可能希望在应用程序 用户界面 (UI)user interface (UI) 上提供一些有关错误的反馈。If the user enters an invalid value, you may want to provide some feedback about the error on the application 用户界面 (UI)user interface (UI). 提供此类反馈的一种方法是设置 ValidationErrorTemplateOne way to provide such feedback is to set the Validation.ErrorTemplate 附加到自定义的属性 ControlTemplateattached property to a custom ControlTemplate.

有关验证的详细讨论,请参阅 数据绑定概述中的 "数据验证" 一节。For a detailed discussion of validation, see the Data Validation section of the Data Binding Overview.

依赖项属性信息Dependency Property Information

标识符字段Identifier field ErrorTemplateProperty
元数据属性设置为 trueMetadata properties set to true IsNotDataBindable

适用于

另请参阅