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

Clear styling of content and set your own

1 Answer 55 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Ola Karlsson
Top achievements
Rank 1
Ola Karlsson asked on 16 Dec 2010, 09:31 AM
Hi there,

I'm using the RichTextBox with the HtmlDataProvider to load content into my richtextbox, I found mention of the fact that you can make chages to the document when it's loaded by using the SetupDocument event, as shown here http://www.telerik.com/help/silverlight/radrichtextbox-features-data-providers.html

I need to clear the font name and the font size, to then force a specific font and font size on the whole loaded document.
Any help on this would be greatly appreciated.
Ola

1 Answer, 1 is accepted

Sort by
0
Accepted
Iva Toteva
Telerik team
answered on 17 Dec 2010, 02:37 PM
Hello Ola Karlsson,

As we already answered here, we decided to provide an option for applying the font-setting properties declared for RadRichTextBox (for spans and paragraphs of the document loaded through HtmlFormatProvider), when they are not explicitly set in the HTML file.
However, what you seem to be up to is not the same. You can set the font properties of the whole document by processing the spans and clearing the values they have been set to. You can handle the SetUpDocument event like this:

private void HtmlDataProvider_SetupDocument(object sender, SetupDocumentEventArgs e)
{
    foreach (Span span in e.Document.EnumerateChildrenOfType<Span>())
    {
        span.ClearValue(Span.FontSizeProperty);
        span.ClearValue(Span.FontFamilyProperty);
        span.ClearValue(Span.FontStyleProperty);
        span.ClearValue(Span.FontWeightProperty);
    }
}

Hope this helps.
 
If you have any other questions, do not hesitate to contact us again.

Greetings,


Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
RichTextBox
Asked by
Ola Karlsson
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or