List Styles

6 posts, 1 answers
  1. Erik
    Erik avatar
    6 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    Hi,

    We are currently using a RichTextBox to display simple HTML content.

    To style the content, we are using this code:

    this.htmlDataProvider.RichTextBox.DefaultStyleSettings.SetPropertyValue(Span.UnderlineColorProperty, foregroundColour);
    this.htmlDataProvider.RichTextBox.DefaultStyleSettings.SetPropertyValue(Span.ForeColorProperty, foregroundColour);
    this.htmlDataProvider.RichTextBox.Background = new SolidColorBrush(backgroundColour);
    this.htmlDataProvider.RichTextBox.FontSize = this.noteStyles.DefaultFontSize;
    this.htmlDataProvider.RichTextBox.FontFamily = new FontFamily(font.Source);

    However, this leaves list icons and list numbers without a style applied: http://i.imgur.com/rbwx4.png

    How can I apply a default style to those elements too?

    Thanks.
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 07 Sep 2012 Link to this post

    Hi,

    Unfortunately we couldn't reproduce the same results as the screenshot you've sent. Can you please assure that the DocumentInheritsDefaultStyleSettings property of the RadRichTextBox is set to true. This is needed so that all the DefaultStyleSettings form the rich text box control are copied to the imported document. 
    If this doesn't work we would appreciate if you could send us the HTML document you are testing with so that we can investigate it thoroughly.

    Regards,
    Alex
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Erik
    Erik avatar
    6 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2012 Link to this post

    So here's some example HTML. It's very simple markup:

    <p><span>Test</span></p>
     
    <ul>
        <li><span>Testing</span></li>
    </ul>
     
    <ol>
        <li><span>Testing</span></li>
        <li><span>Test</span></li>
    </ol>
     
    <p><span>Test</span></p>

    We're assigning that to the RichTextBox by calling an (instance of the bound HtmlDataProvider) htmlDataProvider.Html = "our html string"

    The XAML looks like this:

    <Html:HtmlDataProvider
        Name="htmlDataProvider" 
        RichTextBox="{Binding ElementName=richTextBox}">
    </Html:HtmlDataProvider>
    <telerik:RadRichTextBox
        x:Name="richTextBox"
        DocumentInheritsDefaultStyleSettings="True">
    </telerik:RadRichTextBox>

    We seem to be able to manipulate every property but the color of the list items.

    If you could post your code, showing how you would properly load an HTML document (and change the color of your bullet points, font-family etc), that'd be helpful.

    Thanks.
  5. Answer
    Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 11 Sep 2012 Link to this post

    Hello Erik,

    We still can't reproduce the problem. See the attached image which shows the result on our end.

    I have also attached a demo project illustrating the correct behavior. Can you check it and tells us if the problem still exists?

    Looking forward to your reply.

    All the best,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Erik
    Erik avatar
    6 posts
    Member since:
    Jul 2012

    Posted 13 Sep 2012 Link to this post

    Hi,

    Turns out the problem was that we were using the Q1 2012 version of the Telerik controls and when we updated to Q2 2012 the problem went away.

    Thanks for the quick help anyway.
  7. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 14 Sep 2012 Link to this post

    Hello Erik,

     Its nice to hear that you found a solution to your problem. If you have further questions feel free to contact us again.

    Greetings,
    Mihail
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top
UI for WPF is Visual Studio 2017 Ready