Class Validation
Provides methods and attached properties that support data validation and govern the visual state of the control.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public static class Validation
Fields
| Improve this Doc View SourceErrorsProperty
Identifies the Validation Errors attached property.
Declaration
public static readonly DependencyProperty ErrorsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
HasErrorProperty
Identifies the Validation HasError attached property.
Declaration
public static readonly DependencyProperty HasErrorProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Methods
| Improve this Doc View SourceClearInvalid(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. |
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. |
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. |
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. |