using System.Globalization; using System.Windows.Controls; namespace Gestor.Application.Helpers; public class ObrigatorioValidationRule : ValidationRule { public bool IsRequired { get; set; } public override ValidationResult Validate(object value, CultureInfo cultureInfo) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if (!(value is string text)) { return new ValidationResult(false, (object)"OBRIGATÓRIO"); } if (text != null && IsRequired && string.IsNullOrWhiteSpace(text)) { return new ValidationResult(false, (object)"OBRIGATÓRIO"); } return ValidationResult.ValidResult; } }