public void handlerError(object sender, ValidationEventArgs e) { if (valid) { valid = false; } if (handler != null && handler.GetInvocationList().Length > 0) { handler(sender, e); } }
protected virtual void onValidacao() { if (_validation != null) { var listaValidacao = _validation.GetInvocationList(); var eventArgs = new ValidacaoEventArgs(Text); var ehValido = true; foreach (ValidationEventHandler validacao in listaValidacao) { validacao(this, eventArgs); if (!eventArgs.ehValido) { ehValido = false; break; } } Background = ehValido ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Colors.OrangeRed); } }