//追加 txtResult.Document.Blocks.Add(new Paragraph(new Run("add by run") { Foreground = Brushes.Blue })); //替换 txtResult.Selection.Text = "add by selection";
txtResult.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);
//追加 txtResult.Document.Blocks.Add(new Paragraph(new Run("add by run") { Foreground = Brushes.Blue })); //替换 txtResult.Selection.Text = "add by selection";
txtResult.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);
转载于:https://www.cnblogs.com/dajianshi/p/4662125.html