wpf中RichTextBox文本内容的赋值与获取
赋值:
richtextbox.Document.Blocks.Clear();
string srt="12356457";
Run run=new Run(str);
Paragraph p=new Paragraph();
p.Inlines.add(run);
richtextbox.Document.Blocks.Add(p);
获取:
TextRange textRange = new TextRange(richtextbox.Document.ContentStart, richtextbox.Document.ContentEnd);
return textRange.Text;