2011-07-08 44 views

回答

0

我只是觉得我的问题

((System.Windows.Media.SolidColorBrush)(run.Foreground)).Color.ToString() 

与上面的代码的答案我可以在十六进制文本的颜色。

0

我不知道那是什么方法,是应该做的,但在XAML可以使用:

<RichTextBox Name="MyBox" Text="Some text" Foreground="Red" /> 

,或者你可以把它绑定到一个刷属性:

<RichTextBox Name="MyBox" Text="Some text" Foreground="{Binding myColor}" /> 

如果你想从后面的代码设置:

Brush myBrush = new SolidColorBrush(Color.Red); 
MyBox.Foreground = myBrush;