How to clear text content in RichTextBox

前端 未结 6 706
眼角桃花
眼角桃花 2020-12-15 02:53

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, ri         


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 03:23

    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 = "";
    

提交回复
热议问题