如何从WPF RichTextBox中删除特定字符串(如果该字符串存在)? 换句话说,以下是WinForm RichTextBox版本的WPF等效版本: richTextBox1.Text = "aaabbbccc"; richTextBox1.Text = richTextBox1.Text.Replace("bbb", ""); 谢谢!
这是一种实现方式:TextRange textRange = new TextRange( richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd ); textRange.Text = textRange.Text.Replace("Text", "Document");