private void richTexKeyDown(object sender, KeyEventArgs e) { TextRange tr = new TextRange(richTextBox1.Document.ContentStart ,richTextBox1.Document.ContentEnd); if (tr.Text.Length >= 300 || e.Key == Key.Space || e.Key == Key.Enter) { e.Handled = true; return; } }
RichTextBox.MaxLength
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)