Is it possible t开发者_如何学运维o send a parameter to a custom validationrule?
My validationrule:
public class CustomTypeSelectedRule : IValidationRule
{
public ValidationResult Validate(object input)
{
// Here I need an extra value from the class calling
// the validation rule.
return ValidationResult.Success;
}
}
My property using the validationrule:
[ContractValidation(typeof(ValidationRules.CustomTypeSelectedRule))]
public int CustomType
{
get
{
return this.customType;
}
set
{
this.customType = value;
}
}
Any input is appreciated, thanks!
This might help you - http://michlg.wordpress.com/2010/01/29/wpf-custom-validationrule-with-an-additional-parameter/
精彩评论