Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can put a validation in your binding</p> <pre><code>&lt;TextBox&gt; &lt;TextBox.Text&gt; &lt;Binding Path="CategoriaSeleccionada.ColorFondo" UpdateSourceTrigger="PropertyChanged"&gt; &lt;Binding.ValidationRules&gt; &lt;utilities:RGBValidationRule /&gt; &lt;/Binding.ValidationRules&gt; &lt;/Binding&gt; &lt;/TextBox.Text&gt; &lt;/TextBox&gt; </code></pre> <p>Look at this example (of my program), you put the validation inside the binding like this. With UpdateSourceTrigger you can change when you binding will be updated (lost focus, in every change...)</p> <p>Well, the validation is a class, I will put you an example:</p> <pre><code>class RGBValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { // Here you make your validation using the value object. // If you want to check if the object is only numbers you can // Use some built-in method string blah = value.ToString(); int num; bool isNum = int.TryParse(blah, out num); if (isNum) return new ValidationResult(true, null); else return new ValidationResult(false, "It's no a number"); } } </code></pre> <p>In short, do the job inside that method and return a new ValidationResult. The first parameter is a bool, true if the validation is good, false if not. The second parameter is only a message for information.</p> <p>I think that this is the basics of textbox validation.</p> <p>Hope this help.</p> <p>EDIT: Sorry, I don't know VB.NET but I think that the C# code is pretty simple.</p>
    singulars
    1. This table or related slice is empty.
    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. 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