public void AppendTextToHead(string text)
        {
            TextRange textRange = new TextRange(txtRich.Document.ContentStart, txtRich.Document.ContentEnd);
            //把之前的文本追加到新内容后面
            string value = text + "\r" + textRange.Text;
            Paragraph p = new Paragraph();
            p.Inlines.Add(new Run(value));
            txtRich.Document.Blocks.Clear();
            txtRich.Document.Blocks.Add(p);
        }

代码如上,其他语言也可以用这个逻辑,比如Web的 

 $("#opinfo").html(szTip + $("#opinfo").html());

 

相关文章: