ValidationResult Constructor

ValidationResult Constructor (Boolean, Object^)


Initializes a new instance of the ValidationResult class.

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

	bool isValid,
	Object^ errorContent


Type: System::Boolean

Whether or not the value checked against the ValidationRule is valid.

Type: System::Object^

Information about the invalidity.

The WPF data binding model enables you to associate ValidationRules with your Binding or MultiBinding object. You can create custom rules by subclassing the ValidationRule class and implementing the Validate method. The Validate method returns a ValidationResult object to report whether the checked value is valid.

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

Legacy Code Example

The following example shows the implementation of a validation rule that marks the input value as invalid if it contains non-numeric characters or outside the lower and upper bounds. If the value is invalid, the ErrorContent property and the IsValid property of the returned ValidationResult are set to the appropriate error message and false respectively.

For the complete example, see How to: Implement Binding Validation.

Code snippet is not found. Confirm that the code snippet name 'BindValidation' is correct.

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft