Ejemplo n.º 1
0
 /// <inheritdoc/>
 protected override void OnTextInput(TextCompositionEventArgs e)
 {
     base.OnTextInput(e);
     if (!e.Handled)
     {
         if (e.Text == "\x1b")
         {
             // ASCII 0x1b = ESC.
             // WPF produces a TextInput event with that old ASCII control char
             // when Escape is pressed. We'll just ignore it.
             return;
         }
         TextDocument document = this.Document;
         if (document != null)
         {
             OnTextEntered(e);
             if (!e.Handled)
             {
                 ReplaceSelectionWithText(e.Text);
                 caret.BringCaretToView();
                 e.Handled = true;
             }
         }
     }
 }