protected override void OnTextChanged(TextChangedEventArgs e) { if (_inEvents) { return; } _inEvents = true; var ev = new ValidateTextEventArgs(Text); OnValidateText(this, ev); if (ev.Cancel) { Text = _textBefore; SelectionStart = _selectionStart; SelectionLength = _selectionLength; } _inEvents = false; }
protected virtual void OnValidateText(object sender, ValidateTextEventArgs e) => ValidateText?.Invoke(this, e);