Bewerken

Share via


Validation Class

Definition

Provides methods and attached properties that support data validation.

public ref class Validation abstract sealed
public static class Validation
type Validation = class
Public Class Validation
Inheritance
Validation

Remarks

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

Fields

ErrorEvent

Identifies the Error attached event.

ErrorsProperty

Identifies the Errors attached property.

ErrorTemplateProperty

Identifies the ErrorTemplate attached property.

HasErrorProperty

Identifies the HasError attached property.

ValidationAdornerSiteForProperty

Identifies the ValidationAdornerSiteFor attached property.

ValidationAdornerSiteProperty

Identifies the ValidationAdornerSite attached property.

Attached Properties

Errors

Gets the collection of all active ValidationError objects on the bound element.

ErrorTemplate

Gets or sets the ControlTemplate used to generate validation error feedback on the adorner layer.

HasError

Gets a value that indicates whether any binding on the binding target element has a ValidationError.

ValidationAdornerSite

Gets or sets the element that appears to indicate that a validation error occurred on the bound element where this property is set.

ValidationAdornerSiteFor

Gets or sets the element for which this element appears to indicate that an error occurred.

Methods

AddErrorHandler(DependencyObject, EventHandler<ValidationErrorEventArgs>)

Adds an event handler for the Error attached event to the specified object.

ClearInvalid(BindingExpressionBase)

Removes all ValidationError objects from the specified BindingExpressionBase object.

GetErrors(DependencyObject)

Gets the value of the Errors attached property of the specified element.

GetErrorTemplate(DependencyObject)

Gets the value of the ErrorTemplate attached property of the specified element.

GetHasError(DependencyObject)

Gets the value of the HasError attached property of the specified element.

GetValidationAdornerSite(DependencyObject)

Gets the value of the ValidationAdornerSite attached property for the specified element.

GetValidationAdornerSiteFor(DependencyObject)

Gets the value of the ValidationAdornerSiteFor attached property for the specified element.

MarkInvalid(BindingExpressionBase, ValidationError)

Marks the specified BindingExpression object as invalid with the specified ValidationError object.

RemoveErrorHandler(DependencyObject, EventHandler<ValidationErrorEventArgs>)

Adds an event handler for the Error attached event from the specified object.

SetErrorTemplate(DependencyObject, ControlTemplate)

Sets the value of the ErrorTemplate attached property to the specified element.

SetValidationAdornerSite(DependencyObject, DependencyObject)

Sets the ValidationAdornerSite attached property to the specified value on the specified element.

SetValidationAdornerSiteFor(DependencyObject, DependencyObject)

Sets the ValidationAdornerSiteFor attached property to the specified value on the specified element.

Attached Events

Error

Occurs when the bound element runs into a validation error, but only for bindings with the NotifyOnValidationError value set to true.

Applies to

See also