How to clear text content in RichTextBox

c#, wpf

Solution

Try to create a `TextRange` with `RichBoxText` content, then set `Text` to empty string:

TextRange txt = new TextRange(richtxtSNotice.Document.ContentStart, richtxtSNotice.Document.ContentEnd);
txt.Text = "";

Problem

After getting the text in the RichTextBox I want to clear the text. How can I do that? ``` TextRange txt = new TextRange(richtxtSNotice.Document.ContentStart, richtxtSNotice.Document.ContentEnd); MessageBox.Show(txt.Text); ```

Original source