private void OnInputValidationError(object sender, InputValidationErrorEventArgs e) { if (this.Child != null) { CellEditor.SetHasError(( DependencyObject )this.Child, true); } }
private void Decimal_InputValidationError(object sender, InputValidationErrorEventArgs e) { DecimalUpDown dSender = (DecimalUpDown)sender; string value = dSender.Text; value = value.Replace(',', '.'); decimal parseValue; if (decimal.TryParse(value, NumberStyles.Float, new CultureInfo("en-US"), out parseValue)) { if (parseValue > dSender.Maximum) { dSender.Value = dSender.Maximum; } else if (parseValue < dSender.Minimum) { dSender.Value = dSender.Minimum; } else { dSender.Value = parseValue; } } }
private void RaiseInputValidationError(Exception e) { if (InputValidationError != null) { InputValidationErrorEventArgs args = new InputValidationErrorEventArgs(e); InputValidationError(this, args); if (args.ThrowException) { throw args.Exception; } } }
protected override void OnDateValidationError(DatePickerDateValidationErrorEventArgs e) { base.OnDateValidationError(e); // This validation error may have been raised by the "CommitInput()" call. // If this is the case, use the _commitException member. if (InputValidationError != null) { InputValidationErrorEventArgs args = (_commitException != null) ? new InputValidationErrorEventArgs(_commitException) : new InputValidationErrorEventArgs(e.Exception); InputValidationError(this, args); if (args.ThrowException) { throw args.Exception; } } }
protected void SyncTextAndValueProperties(bool updateValueFromText, string text) { if (_isSyncingTextAndValueProperties) { return; } _isSyncingTextAndValueProperties = true; Exception error = null; if (updateValueFromText) { try { Value = ConvertTextToValue(text); } catch (Exception e) { error = e; } } Text = ConvertValueToText(); if (TextBox != null) { TextBox.Text = Text; } if (updateValueFromText) { if ((error != null) && (InputValidationError != null)) { InputValidationErrorEventArgs args = new InputValidationErrorEventArgs(error.Message); InputValidationError(this, args); } } _isSyncingTextAndValueProperties = false; }
private void txt_InputValidationError(object sender, InputValidationErrorEventArgs e) { Funcoes.Mensagem("Valor Inválido", TituloErro, MessageBoxButton.OK); }