Validator.TryValidateProperty Method
Silverlight
Determines whether the specified property value is valid.
Namespace: System.ComponentModel.DataAnnotations
Assembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
public static bool TryValidateProperty( Object value, ValidationContext validationContext, ICollection<ValidationResult> validationResults )
Parameters
- value
- Type: System.Object
The value to validate.
- validationContext
- Type: System.ComponentModel.DataAnnotations.ValidationContext
An object that contains information about the validation request.
- validationResults
- Type: System.Collections.Generic.ICollection<ValidationResult>
A collection to store validation results.
| Exception | Condition |
|---|---|
| ArgumentException | MemberName of validationContext is not a valid property. |
The TryValidateProperty method tests each ValidationAttribute attribute associated with the property that is identified by the validationContext parameter.
If validationResults is null, the method stops at the first validation failure. If validationResults is not null, the method evaluates all validation attributes and adds all of the failures to validationResults.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.