Luis Lopez

Luis Lopez

  • NA
  • 52
  • 1.7k

How make validation fiels in c# wpf

Nov 17 2021 11:51 PM

I try make a validation fiels but don't work it. SomeOne have a example how i make it?
Sorry for my bad English

*My validation class 

using System.Globalization;
using System.Windows.Controls;

namespace App.Clases
{
    public class NotEmptyValidationRule: ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            return string.IsNullOrWhiteSpace((value ?? "").ToString())
                ? new ValidationResult(false, "Required Field.")
                : ValidationResult.ValidResult;
            //throw new System.NotImplementedException();
        }
    }
}
 


Answers (2)