2011-07-08 74 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;