Redigera

Dela via


DataErrorValidationRule Class

Definition

Represents a rule that checks for errors that are raised by the IDataErrorInfo implementation of the source object.

public ref class DataErrorValidationRule sealed : System::Windows::Controls::ValidationRule
public sealed class DataErrorValidationRule : System.Windows.Controls.ValidationRule
type DataErrorValidationRule = class
    inherit ValidationRule
Public NotInheritable Class DataErrorValidationRule
Inherits ValidationRule
Inheritance
DataErrorValidationRule

Remarks

The WPF data binding model enables you to associate ValidationRules with a Binding object. If your source object implements the IDataErrorInfo interface, you can use the built-in rule DataErrorValidationRule to check for errors raised by the IDataErrorInfo implementation.

An alternative syntax to setting the DataErrorValidationRule explicitly is to set the ValidatesOnDataErrors property to true on your Binding or MultiBinding object.

You can create a custom rule by creating a class that derives from ValidationRule. For more information and a detailed discussion of data validation, see Data Binding Overview.

DataErrorValidationRule is introduced in the .NET Framework version 3.5. For more information, see Versions and Dependencies.

Constructors

DataErrorValidationRule()

Initializes a new instance of the DataErrorValidationRule class.

Properties

ValidatesOnTargetUpdated

Gets or sets a value that indicates whether the validation rule runs when the target of the Binding is updated.

(Inherited from ValidationRule)
ValidationStep

Gets or sets when the validation rule runs.

(Inherited from ValidationRule)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
Validate(Object, CultureInfo, BindingExpressionBase)

Performs validation checks on a value.

(Inherited from ValidationRule)
Validate(Object, CultureInfo, BindingGroup)

Performs validation checks on a value.

(Inherited from ValidationRule)
Validate(Object, CultureInfo)

Performs validation checks on a value.

Applies to

See also