This is a migrated thread and some comments may be shown as answers.

Default BulletList Style

5 Answers 249 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Johann
Top achievements
Rank 1
Johann asked on 14 May 2014, 08:45 AM
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

5 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 19 May 2014, 08:41 AM
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.
 
0
Johann
Top achievements
Rank 1
answered on 22 May 2014, 09:15 AM
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
0
Mihail
Telerik team
answered on 26 May 2014, 07:35 AM
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.
 
0
MANTU
Top achievements
Rank 1
answered on 06 Aug 2014, 04:09 PM
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.
0
MANTU
Top achievements
Rank 1
answered on 07 Aug 2014, 07:22 AM
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.
Tags
RichTextBox
Asked by
Johann
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Johann
Top achievements
Rank 1
MANTU
Top achievements
Rank 1
Share this question
or