Setting font size for a RadRichTextBox

8 posts, 0 answers
  1. Simon
    Simon avatar
    159 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. DevCraft banner
  4. 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
  5. 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 >>

  6. 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
  7. 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???/
  8. Petya
    Petya avatar
    975 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.

  9. Rosa
    Rosa avatar
    4 posts
    Member since:
    Dec 2016

    Posted 8 hours ago 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?!?

Back to Top
DevCraft banner