コード例 #1
0
        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;
        }
コード例 #2
0
 protected virtual void OnValidateText(object sender, ValidateTextEventArgs e) => ValidateText?.Invoke(this, e);