Where can I find the built in default style?

4 posts, 0 answers
  1. Edward
    Edward avatar
    83 posts
    Member since:
    Feb 2011

    Posted 12 Apr 2012 Link to this post

    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?
  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 17 Apr 2012 Link to this post

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

  3. DevCraft banner
  4. Edward
    Edward avatar
    83 posts
    Member since:
    Feb 2011

    Posted 23 Apr 2012 Link to this post

    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.
  5. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 24 Apr 2012 Link to this post

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

Back to Top