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

Setting font size for a RadRichTextBox

8 Answers 820 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 08 Jan 2011, 07:24 AM
Do you have an example on how we should use the RadRichTextBox DefaultStyleSettings in code behind?

8 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 11 Jan 2011, 06:15 PM
Hi Simon,

The DefaultStyleSettings property is of type StyleDefinition and is manipulated through the GetPropertyValue and SetPropertyValue methods. It has to do with the style settings that are applied to paragraphs and spans that have not been set values for the following properties:

  • FontFamily;
  • FontSize;
  • FontStyle;
  • FontWeight.
Here is an example of how you can use this property:

StyleDefinition style = this.radRichTextBox.Document.DefaultStyleSettings;
double? leftIndent = (double?)style.GetPropertyValue(Paragraph.LeftIndentProperty);
style.SetPropertyValue(Span.FontFamilyProperty, new FontFamily("Comic Sans MS"));
style.SetPropertyValue(Paragraph.FontSizeProperty, Unit.PointToDip(4));
If you have any other questions, do not hesitate to contact us again.

Greetings,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Dinesh
Top achievements
Rank 1
answered on 12 Oct 2011, 11:33 AM
Hi,

How to set fontsize to radRichTextbox using style ?.. I mean to say using setter property.

I can set font writing this code in xaml. But i have many such richtextbox used in my application. I want to set the font using Style.

<

telerik:RadRichTextBox.Document>

     <telerik:RadDocument>

        <telerik:Section>

            <telerik:Paragraph FontSize="12"/>

        </telerik:Section>

    </telerik:RadDocument>

 </telerik:RadRichTextBox.Document>

 


Can anyone plz help me out ?

Thanks,
Dinesh Patel
0
Iva Toteva
Telerik team
answered on 12 Oct 2011, 12:44 PM
Hi Dinesh Patel,

Please refer to this article regarding the setting of default style settings on the document.
You can also set these properties in a Style and apply it to all RadRichTextBoxes in your application.

Best wishes,
Iva
the Telerik team

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

0
Dinesh
Top achievements
Rank 1
answered on 12 Oct 2011, 02:06 PM
Thanks a lot for your help :)

- Dinesh Patel
0
Amruta
Top achievements
Rank 1
answered on 02 Apr 2015, 10:32 AM
Hi

As suggested in the article link, it just initially sets font properties. Once I saved and open again default Verdana font gets set.

Pls help???/
0
Petya
Telerik team
answered on 06 Apr 2015, 03:27 PM
Hi Amruta,

Please take a look at my reply in the other thread you posted about this in.

Regards,
Petya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
rosa
Top achievements
Rank 1
answered on 07 Dec 2016, 04:00 PM

Hi dear Admin

I have a problem about radrichtexteditor, I set something such  as margin, font page size and so on but when this code is executed 

Radrichtexteditor1.Document=document;

all of the setting that i have set on radRichTextEditor dont work what is the problem?!?

0
Boby
Telerik team
answered on 12 Dec 2016, 09:05 AM
Hello Rosa,

Each of these is property of the RadDocument itself, or part of the document model. So when you change the current document with another instance of document, it carries all these properties with itself. Depending on your scenario, you can use RadRichTextBox.DocumentChanged event and apply the needed formatting just after the document is changed.

Regards,
Boby
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
Simon
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Dinesh
Top achievements
Rank 1
Amruta
Top achievements
Rank 1
Petya
Telerik team
rosa
Top achievements
Rank 1
Boby
Telerik team
Share this question
or