We are currently using a RichTextBox to display simple HTML content.
To style the content, we are using this code:
this
.htmlDataProvider.RichTextBox.DefaultStyleSettings.SetPropertyValue(Span.UnderlineColorProperty, foregroundColour);
this
.htmlDataProvider.RichTextBox.DefaultStyleSettings.SetPropertyValue(Span.ForeColorProperty, foregroundColour);
this
.htmlDataProvider.RichTextBox.Background =
new
SolidColorBrush(backgroundColour);
this
.htmlDataProvider.RichTextBox.FontSize =
this
.noteStyles.DefaultFontSize;
this
.htmlDataProvider.RichTextBox.FontFamily =
new
FontFamily(font.Source);
However, this leaves list icons and list numbers without a style applied: http://i.imgur.com/rbwx4.png
How can I apply a default style to those elements too?
Thanks.
5 Answers, 1 is accepted
Unfortunately we couldn't reproduce the same results as the screenshot you've sent. Can you please assure that the DocumentInheritsDefaultStyleSettings property of the RadRichTextBox is set to true. This is needed so that all the DefaultStyleSettings form the rich text box control are copied to the imported document.
If this doesn't work we would appreciate if you could send us the HTML document you are testing with so that we can investigate it thoroughly.
Alex
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
<
p
><
span
>Test</
span
></
p
>
<
ul
>
<
li
><
span
>Testing</
span
></
li
>
</
ul
>
<
ol
>
<
li
><
span
>Testing</
span
></
li
>
<
li
><
span
>Test</
span
></
li
>
</
ol
>
<
p
><
span
>Test</
span
></
p
>
We're assigning that to the RichTextBox by calling an (instance of the bound HtmlDataProvider) htmlDataProvider.Html = "our html string"
The XAML looks like this:
<
Html:HtmlDataProvider
Name
=
"htmlDataProvider"
RichTextBox
=
"{Binding ElementName=richTextBox}"
></
Html:HtmlDataProvider
>
<
telerik:RadRichTextBox
x:Name
=
"richTextBox"
DocumentInheritsDefaultStyleSettings
=
"True"
>
</
telerik:RadRichTextBox
>
We seem to be able to manipulate every property but the color of the list items.
If you could post your code, showing how you would properly load an HTML document (and change the color of your bullet points, font-family etc), that'd be helpful.
Thanks.
We still can't reproduce the problem. See the attached image which shows the result on our end.
I have also attached a demo project illustrating the correct behavior. Can you check it and tells us if the problem still exists?
Looking forward to your reply.
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Turns out the problem was that we were using the Q1 2012 version of the Telerik controls and when we updated to Q2 2012 the problem went away.
Thanks for the quick help anyway.
Its nice to hear that you found a solution to your problem. If you have further questions feel free to contact us again.
Mihail
the Telerik team
Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.