3 Answers, 1 is accepted
If you want to change any of the following properties (FontFamily, FontSize, FontStyle or FontWeight) you can do it directly in xaml or in code behind by setting the respective property and setting DocumentInheritsDefaultStyleSettings to true as described in this article.
If you want to change some of the properties of the paragraph or the table, you can do it only in code behind by accessing the DefaultStyleSettings property of RadRichTextBox as shown bellow:
this.editor.DocumentInheritsDefaultStyleSettings = true;
this.editor.DefaultStyleSettings.ParagraphProperties.Background = Colors.Yellow;
this.editor.DefaultStyleSettings.ParagraphProperties.TextAlignment = RadTextAlignment.Center;
There is another way to change the default style of a specific document by using the Style property of the document like this:
this.editor.Document.Style.SpanProperties.ForeColor = Colors.Brown;
this.editor.Document.Style.ParagraphProperties.Background = Colors.Green;
If you have further questions, do not hesitate to contact us again.
Kind regards,
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
But then, since we are talking about this.... I cannot find this.editor.DefaultStyleSettings.ParagraphProperties. I see DefaultStyleSettings but then nothing inside.
DefaultStyleSettings is of type StyleDefinition, which is located in Telerik.Windows.Documents.Model.Styles namespace. Please check if you are using this namespace, it should reveal the ParagraphProperties of DefaultStyleSettings. We introduced these properties in 2011 Q2 version, please make sure you are using this or a more recent version.
About the default style of our RadRichTextBox in my last post I described how the default style works. If you continued to experience difficulties you can give use more detailed information about what you are trying to achieve so we can help you further.
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>