开发者

Getting text color from Silverlight RichTextBox

I have a problem with the getting 开发者_开发知识库the RichTextBox`s text color. There is a method about it but i was fail with it. help me to use this method or is there any way to do this. Here is the method

run.Foreground(DependencyProperty)


I'm not sure what that method is supposed to do, but in XAML you would use:

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

or you could bind it to a Brush property:

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

If you're trying to set it from code behind:

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


I just find the answer of my question

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

with above code i can get the color of the text in hex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜