Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to specify the MemberNames that are associated with the ValidationResult. The constructor of ValidationResult has an additional parameter to specify the properties that are associated with the result. If you do not specify any properties, the result is handled as a validation error on entity level.</p> <p>So in your case, it should be fixed, when you pass in the name of the property to the constructor of the ValidationResult.</p> <pre><code>protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null &amp;&amp; this.disallowedCharacters.Count() &gt; 0) { string Value = value.ToString(); foreach(char val in this.disallowedCharacters) { if ((!this.CaseSensitive &amp;&amp; Value.ToLower().Contains(val)) || Value.Contains(val)) { //return new ValidationResult(string.Format(this.ErrorMessage != null ? this.ErrorMessage : "'{0}' is not allowed an allowed character.", val.ToString())); string errorMessage = string.Format(this.ErrorMessage != null ? this.ErrorMessage : "'{0}' is not allowed an allowed character.", val.ToString()); return new ValidationResult(errorMessage, new string[] { validationContext.MemberName}); } } } return ValidationResult.Success; } </code></pre> <p>For the bindings you don´t need to specify anything else. So the simple Binding</p> <pre><code>{Binding Value} </code></pre> <p>should display errors, cause <strong>ValidatesOnNotifyDataErrors</strong> is set to true implicitly. <strong>NotifyOnValidationError</strong> populates ValidationErrors to other elements like ValidationSummary.</p> <p>Jeff Handly has a really goog <a href="http://jeffhandley.com/archive/2010/09/22/RiaServicesStandardValidators.aspx" rel="nofollow">blog post</a> about Validation in WCF Ria Services and Silverlight, i can recommened to read.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload