WPF RichTextBox设置文本颜色

//追加
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);

 

posted @ 2015-07-20 17:52  柒零壹  阅读(3429)  评论(0编辑  收藏  举报