Setting font size for a RadRichTextBox

9 posts, 0 answers
  1. Simon
    Simon avatar
    166 posts
    Member since:
    Sep 2010

    Posted 08 Jan 2011 Link to this post

    Do you have an example on how we should use the RadRichTextBox DefaultStyleSettings in code behind?

  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 11 Jan 2011 Link to this post

    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.

    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Dinesh
    Dinesh avatar
    4 posts
    Member since:
    Oct 2011

    Posted 12 Oct 2011 Link to this post


    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:Paragraph FontSize="12"/>





    Can anyone plz help me out ?

    Dinesh Patel
  4. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 12 Oct 2011 Link to this post

    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,
    the Telerik team

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

  5. Dinesh
    Dinesh avatar
    4 posts
    Member since:
    Oct 2011

    Posted 12 Oct 2011 Link to this post

    Thanks a lot for your help :)

    - Dinesh Patel
  6. Amruta
    Amruta avatar
    11 posts
    Member since:
    Mar 2015

    Posted 02 Apr 2015 in reply to Iva Toteva Link to this post


    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???/
  7. Petya
    Petya avatar
    989 posts

    Posted 06 Apr 2015 Link to this post

    Hi Amruta,

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


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

  8. rosa
    rosa avatar
    10 posts
    Member since:
    Dec 2016

    Posted 07 Dec 2016 Link to this post

    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 


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

  9. Boby
    Boby avatar
    730 posts

    Posted 12 Dec 2016 Link to this post

    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.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top