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

Default styles for RadRichTextBox

1 Answer 228 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.
Steve
Top achievements
Rank 1
Steve asked on 30 Apr 2012, 08:41 PM
Hi,

I am using Telerik 2012 Q1 version for my silverlight radrichtextbox.

The following is my xaml code

 <telerik:RadRichTextBox  Name="RichTextBoxNotificationText"  Grid.ColumnSpan="4" Grid.Row="19"  Margin="5,2,5,0" VerticalAlignment="Stretch" IsSpellCheckingEnabled="True"
                                         IsImageMiniToolBarEnabled="False" ScrollViewer.VerticalScrollBarVisibility="Visible" IsSelectionMiniToolBarEnabled="False" 
                                         DocumentInheritsDefaultStyleSettings="True" LayoutMode="Flow" VerticalScrollBarVisibility="Visible" TabIndex="{Binding DdlNotificationToFilerTextTabIndex}" telerikHtml:HtmlDataProvider.Source="{Binding NotificationText}"
                                         FontFamily="{StaticResource FontFamily}" FontSize="{StaticResource StandardFontSize}" FontStyle="{StaticResource FontStyle_Normal}" 
                                         Foreground="{StaticResource ForeGround}">
                    
                        <telerik:RadDocument   LineSpacing="1" ParagraphDefaultSpacingAfter="0" ParagraphDefaultSpacingBefore="0" LineSpacingType="AtLeast"  />
                   
                </telerik:RadRichTextBox>

In ViewModel:

If i assign:

NotificationText = "New Value";

It is not taking default font properties as assigned above.
Please let me know how to remove the Telerik inbuilt styles and only take the styles which i am assiging using through static resource.

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 03 May 2012, 06:18 PM
Hello Steve,

RadRichTextBox uses its default settings for FontFamily and FontSize when you open a new document or when you are showing plain text. If you open a .txt file, for example, or use TxtDataProvider to bind the content of the document, the default style settings will be used. However, if you import a rich text document, such as HTML, the font settings specified in the document will be used. If there are no explicit values for font size and font family, the default values of the format will be used. In the case of HTML that would be Times New Roman 11. This is the behavior by design, which ensures that the document will be shown as closest as possible to the way it would in a browser or Microsoft Word.

If you want to load a rich text document, but alter the way it looks, you can handle the SetupDocument event and change the document as you see fit. You can find more information and some examples of using this event in this article. Note that the data providers create a new document every time the property they are bound to changes. Therefore, the settings you have declared on RadDocument in XAML will not be used. You can set them in the handler of the SetupDocument event.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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