This is a migrated thread and some comments may be shown as answers.

Changing underline color

6 Answers 204 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anatoly Chekh
Top achievements
Rank 1
Anatoly Chekh asked on 18 Jun 2011, 12:43 PM
Hello!

I have a question:

I want to use underline style for some text. In editor I execute command _textBox.Commands.ToggleUnderlineCommand.Execute(isChecked ? TextDecorations.Underline : null);

How can I change underline color?

Thanks, Anatoly.

6 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 21 Jun 2011, 07:54 AM
Hi Anatoly Chekh,

Custom colors for the underline are currently not supported. The color of the underline depends on the fore color of the text that is being underlined.
On a side note, the ToggleUnderlineCommand does not respect the parameter which can be passed to it, it just changes the state of the selection/current word - if the whole text is underlined, the underline is removed, otherwise - the whole selection/word is underlined.
If this is not the behavior you wish to have, you can use the ChangeUnderlineDecoration method or ChangeUnderlineDecorationCommand. You can also utilize the different Underline types as follows:

this.radRichTextBox1.ChangeUnderlineDecoration(UnderlineTypes.DotDotDashedLine);
Kind regards,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anatoly Chekh
Top achievements
Rank 1
answered on 21 Jun 2011, 01:00 PM
"The color of the underline depends on the fore color of the text that is being underlined."

Yes, by default - it's true.

But when I get Xaml from text box - I always get underline color '#FF000000'. But real fore color is white. And when I set this xaml to the text box - I get black underline.
0
Vesko
Telerik team
answered on 22 Jun 2011, 12:35 PM
Hi Anatoly Chekh,

Thanks for your question!
Actually there is a property in Telerik.Windows.Documents.Model.Span class called UnderlineColor. If you set it, its value will override the ForeColor property. Unfortunately currently there isn't an undoable command to change that property. However we will do our best to add it in the upcoming Q2.

Regards,
Vesko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anatoly Chekh
Top achievements
Rank 1
answered on 22 Jun 2011, 07:18 PM
Thanks a lot
0
Anatoly Chekh
Top achievements
Rank 1
answered on 26 Jul 2011, 03:05 PM
Is there any command for changing it in the Q2?
0
Iva Toteva
Telerik team
answered on 29 Jul 2011, 08:33 AM
Hello Anatoly Chekh,

Unfortunately, this feature just missed the release deadline for Q2, but we have added it in the development version and it will be released in the next internal build.

All the best,
Iva
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
RichTextBox
Asked by
Anatoly Chekh
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Anatoly Chekh
Top achievements
Rank 1
Vesko
Telerik team
Share this question
or