Default BulletList Style

6 posts, 0 answers
  1. Johann
    Johann avatar
    28 posts
    Member since:
    Nov 2010

    Posted 14 May 2014 Link to this post

    Hi,

    i have a Problem with the Bullet List.

    How can I set the default row height and the default line spacing from the BulletList in my richtextbox?

    my XAML-Code Looks like this:

    ​<telerik:HtmlDataProvider Name="DataProvider" RichTextBox="{Binding ElementName=radRichTextBox1}" Html="{Binding Antworttext, Mode=TwoWay}">
    <telerik:HtmlDataProvider.FormatProvider>
    <telerik:HtmlFormatProvider>
    <telerik:HtmlFormatProvider.ImportSettings>
    <telerik:HtmlImportSettings UseDefaultStylesheetForFontProperties="True" />
    </telerik:HtmlFormatProvider.ImportSettings>

    </telerik:HtmlFormatProvider>
    </telerik:HtmlDataProvider.FormatProvider>
    </telerik:HtmlDataProvider>

    <telerik:RadRichTextBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="5" x:Name="radRichTextBox1" IsReadOnly="true" BorderThickness="0" DocumentChanged="radRichTextBox1_DocumentChanged"
    HorizontalScrollBarVisibility="Hidden" HorizontalAlignment="Stretch" IsContextMenuEnabled="true" FontFamily="Arial" FontSize="{DynamicResource FontSizeAnswers_rightColumn}" FontStyle="Normal" FontWeight="Normal" DocumentInheritsDefaultStyleSettings="True"
    IsFocusable="False" IsHitTestVisible="False" IsImageMiniToolBarEnabled="False" IsSelectionEnabled="true" IsSelectionMiniToolBarEnabled="false"
    IsSpellCheckingEnabled="False" >
    <telerik:RadRichTextBox.Resources>
    <Style TargetType="{x:Type Paragraph}">
    <Setter Property="Padding" Value="0"/>
    <Setter Property="LineHeight" Value="200"/>
    <Setter Property="Background" Value="Red"/>
    </Style>

    </telerik:RadRichTextBox.Resources>
    </telerik:RadRichTextBox>


    Thank you
  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 19 May 2014 Link to this post

    Hello Johann,

     I am afraid that you can not specify the line spacing for the default list style. You can access all of the available properties by using the DefaultListStyles static class. Here is example on how to do it: 
    DefaultListStyles.Bulleted.Levels[levelIndex]

    Possible workaround can be to determine the newly added paragraphs with assigned bulleted list style and apply them the needed spacing. This can be done by attaching to the CommandExecuted event of the RadRichTextBox. You can manipulate the lists using the RadDocument.ListManager.
    Here is an article explaining the lists in RadRichTextBox.


    I am also afraid that there is no default height for table rows. The workaround here is also to attach to the CommandExecuted event and listen for the InsertTableCommand, InsertTableRowCommand, InsertTableRowAboveCommand and InsertTableRowBelowCommand and change the height of each row.

    If you have further questions feel free to contact us again.

    Regards,
    Mihail
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Johann
    Johann avatar
    28 posts
    Member since:
    Nov 2010

    Posted 22 May 2014 in reply to Mihail Link to this post

    Hi,

    Thank you for your reply,

    but my Problem is to attach the list style to the whole documet.

    In my code snippet above you can see, that i have a read only RadRichTextBox. With the HTMLDataProvider i load the data from a SQL-Source into the Richtextbox. At this i have to attach the Default Listboxstyle. How can i do this.

    Can you provide me with a Little demo-snippet please. I dont know how to do this in Code-behind

    At the Little attached photo you can see the space between the Listrows. i want to decrease this space

    Is this possible to do in DocumentLoaded Event?

    Thank you very much.


    Johann
  5. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 26 May 2014 Link to this post

    Hello Johann,

     Thank for getting back to us with more information about your scenario and specific questions.

    Here is the requested code snippet:
    private void ApplyInitalSettingToDocument(RadDocument document)
    {
        ListStyle listStyle = DefaultListStyles.Bulleted;
        DocumentList documentList = new DocumentList(listStyle, document);
     
        foreach (Paragraph paragraph in document.EnumerateChildrenOfType<Paragraph>())
        {
            paragraph.ListId = documentList.ID; // applying the list id to the paragraph.
            paragraph.SpacingAfter = 0; // removing the spacing after of all paragraphs.
        }
     
        this.radRichTextBox.UpdateEditorLayout();
    }

    You can call this method at RadRichTextBox.Loaded and RadRichTextBox.DocumentChanged events.

    In case you have further questions do not hesitate to contact us again.

    Regards,
    Mihail
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. MANTU
    MANTU avatar
    2 posts
    Member since:
    Aug 2014

    Posted 06 Aug 2014 in reply to Mihail Link to this post

    I have a requirement to reduce the default font size of the bullets be it bulleted or numbered. Can you let me know how can i achieve the same.
  7. MANTU
    MANTU avatar
    2 posts
    Member since:
    Aug 2014

    Posted 07 Aug 2014 in reply to MANTU Link to this post

    Please ignore this post i was able to fix it by going through each default list style and its levels and for each level setting the FontSize and FontFamily on the SpanProperties of the level.
Back to Top
UI for WPF is Visual Studio 2017 Ready