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

Where can I find the built in default style?

3 Answers 93 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 12 Apr 2012, 07:27 PM
I want to find the built in, default style for the document.  I want to edit it based on that.

Where can I find them?

3 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 17 Apr 2012, 03:49 PM
Hello Edward,

 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;
In this way when you change the document of the RadRichTextBox those properties will be synchronized and will be applied on the new document.

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;
Notice that those changes are with higher priority and will override the default style of RadRichTextBox. Also those changes will not be applied if another document is shown. 

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 >>

0
Edward
Top achievements
Rank 1
answered on 23 Apr 2012, 04:13 PM
I mean, what is the default style that the RichTextEditor use if I do not specify any style at all?

But then, since we are talking about this.... I cannot find this.editor.DefaultStyleSettings.ParagraphProperties.  I see DefaultStyleSettings but then nothing inside.
0
Mihail
Telerik team
answered on 24 Apr 2012, 02:37 PM
Hello Edward,

 
 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.

Greetings,
Mihail
the Telerik team

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

Tags
RichTextBox
Asked by
Edward
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Edward
Top achievements
Rank 1
Share this question
or