Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Validation Class
Collapse the table of content
Expand the table of content

Validation Class

Provides methods and attached properties that support data validation.

System.Object
  System.Windows.Controls.Validation

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

[<AbstractClass>]
[<Sealed>]
type Validation =  class end

The Validation type exposes the following members.

  NameDescription
Public attached propertyErrorsGets the collection of all active ValidationError objects on the bound element.
Public attached propertyErrorTemplateGets or sets the ControlTemplate used to generate validation error feedback on the adorner layer.
Public attached propertyHasErrorGets a value that indicates whether any binding on the binding target element has a ValidationError.
Public attached propertyValidationAdornerSiteGets or sets the element that appears to indicate that a validation error occurred on the bound element where this property is set.
Public attached propertyValidationAdornerSiteForGets or sets the element for which this element appears to indicate that an error occurred.
Top

  NameDescription
Public methodStatic memberAddErrorHandlerAdds an event handler for the Error attached event to the specified object.
Public methodStatic memberClearInvalidRemoves all ValidationError objects from the specified BindingExpressionBase object.
Public methodStatic memberGetErrorsGets the value of the Errors attached property of the specified element.
Public methodStatic memberGetErrorTemplateGets the value of the ErrorTemplate attached property of the specified element.
Public methodStatic memberGetHasErrorGets the value of the HasError attached property of the specified element.
Public methodStatic memberGetValidationAdornerSiteGets the value of the ValidationAdornerSite attached property for the specified element.
Public methodStatic memberGetValidationAdornerSiteForGets the value of the ValidationAdornerSiteFor attached property for the specified element.
Public methodStatic memberMarkInvalidMarks the specified BindingExpression object as invalid with the specified ValidationError object.
Public methodStatic memberRemoveErrorHandlerAdds an event handler for the Error attached event from the specified object.
Public methodStatic memberSetErrorTemplateSets the value of the ErrorTemplate attached property to the specified element.
Public methodStatic memberSetValidationAdornerSiteSets the ValidationAdornerSite attached property to the specified value on the specified element.
Public methodStatic memberSetValidationAdornerSiteForSets the ValidationAdornerSiteFor attached property to the specified value on the specified element.
Top

  NameDescription
Public attached eventErrorOccurs when the bound element runs into a validation error, but only for bindings with the NotifyOnValidationError value set to true.
Top

  NameDescription
Public fieldStatic memberErrorEventIdentifies the Error attached event.
Public fieldStatic memberErrorsPropertyIdentifies the Errors attached property.
Public fieldStatic memberErrorTemplatePropertyIdentifies the ErrorTemplate attached property.
Public fieldStatic memberHasErrorPropertyIdentifies the HasError attached property.
Public fieldStatic memberValidationAdornerSiteForPropertyIdentifies the ValidationAdornerSiteFor attached property.
Public fieldStatic memberValidationAdornerSitePropertyIdentifies the ValidationAdornerSite attached property.
Top

For a detailed discussion of the validation process, see "Data Validation" in Data Binding Overview.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft