Show / Hide Table of Contents

Class Validation

Provides methods and attached properties that support data validation and govern the visual state of the control.

Inheritance
System.Object
Validation
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public static class Validation

Fields

| Improve this Doc View Source

ErrorsProperty

Identifies the Validation Errors attached property.

Declaration
public static readonly DependencyProperty ErrorsProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

HasErrorProperty

Identifies the Validation HasError attached property.

Declaration
public static readonly DependencyProperty HasErrorProperty
Field Value
Type Description
DependencyProperty

Methods

| Improve this Doc View Source

ClearInvalid(BindingExpression)

Clears the ValidationError that was set through a call to MarkInvalid or a previously failed validation of that BindingExpression.

Declaration
public static void ClearInvalid(BindingExpression bindingExpression)
Parameters
Type Name Description
BindingExpression bindingExpression

The object to turn valid.

Exceptions
Type Condition
System.ArgumentNullException

bindingExpression is null.

| Improve this Doc View Source

GetErrors(DependencyObject)

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

Declaration
public static ReadOnlyObservableCollection<ValidationError> GetErrors(DependencyObject element)
Parameters
Type Name Description
DependencyObject element

The UIElement object to read the value from.

Returns
Type Description
System.Collections.ObjectModel.ReadOnlyObservableCollection<ValidationError>

A System.Collections.ObjectModel.ReadOnlyObservableCollection<T>.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

| Improve this Doc View Source

GetHasError(DependencyObject)

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

Declaration
public static bool GetHasError(DependencyObject element)
Parameters
Type Name Description
DependencyObject element

The UIElement object to read the value from.

Returns
Type Description
System.Boolean

The value of the Validation HasError attached property of the specified element.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

| Improve this Doc View Source

MarkInvalid(BindingExpression, ValidationError)

Mark this BindingExpression as invalid. If the BindingExpression has been explicitly marked invalid in this way, then it will remain invalid until ClearInvalid is called or another transfer to the source validates successfully.

Declaration
public static void MarkInvalid(BindingExpression bindingExpression, ValidationError validationError)
Parameters
Type Name Description
BindingExpression bindingExpression

The BindingExpression object to mark as invalid.

ValidationError validationError

The ValidationError object to use.

Exceptions
Type Condition
System.ArgumentNullException

bindingExpression is null or validationError is null.

  • Improve this Doc
  • View Source