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

Default font and line spacing for lists in richtextobx

5 Answers 402 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Grigory
Top achievements
Rank 2
Grigory asked on 14 Apr 2015, 05:52 PM

Hello,

I use richtextbox with XamlDataProvider, and I would like to change default font size (set it to 8) and line spacing (set it to 1) for bullets and numbered lists. It means, when the control is loaded and a user creates one of the lists, default font size and line spacing should be 8 and 1 (or other values I set in the code)

I could do such functionality for simple text, but couldn't for lists. In the attached file you can find described issue from a user point of view (if he or she started writing text without any settings changes)

Below you can also find my code.

Hope for your help.

Thanks.

XAML:

... 
 
<telerik:XamlDataProvider x:Name="XamlDataProvider"  Xaml="{Binding ElementName=RichTextBoxControl, Path=Text, ode=TwoWay}" RichTextBox="{Binding ElementName=Editor}" SetupDocument="XamlDataProvider_OnSetupDocument"/>
 
<telerik:RadRichTextBox Name="Editor" Grid.Row="1" PreviewMouseDoubleClick="Editor_OnPreviewMouseDoubleClick" IsSpellCheckingEnabled="False" DocumentInheritsDefaultStyleSettings="True" FontSize="12"/>

 

...

C#:

... 
 
private void XamlDataProvider_OnSetupDocument(object sender, SetupDocumentEventArgs e)
{
    e.Document.ParagraphDefaultSpacingAfter = 0;
    e.Document.LineSpacingType = LineSpacingType.Auto;
    e.Document.LineSpacing = 1;
}

 

...

5 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 16 Apr 2015, 12:52 PM
Hi Grigory,

By default, the style settings of the bullets are inherited from the paragraph's style settings. As I am not sure if I properly understand your requirements and in forum posts you can attach only images, could you try to describe your requirements in more details? 

Regards,
Tanya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Grigory
Top achievements
Rank 2
answered on 16 Apr 2015, 06:26 PM

Hello, Tanya.

It is strange, but my screenshot wasn't attached to my previous message. I'm trying to attach it to this one.

"By default, the style settings of the bullets are inherited from the paragraph's style settings". For me it doesn't work, so I have different font size for bullets (numbers) and for simple text.  You can see the difference in the attached file.

Thank you.

 

Regards,

Grigory

0
Grigory
Top achievements
Rank 2
answered on 16 Apr 2015, 06:28 PM
Note: I didn't change any settings as a user. I just changed font size in the code (as a developer)
0
Tanya
Telerik team
answered on 21 Apr 2015, 02:22 PM
Hello Grigory,

This behavior could be observed if the FontSize property is set to the text, but not to the paragraph end symbol. If you select the text and then change the FontSize, please, check the selection and verify that the symbol is selected along with the text.

If this is not helpful for you, it would be great if you share the code you are using for changing the font size and confirm that you are using the latest version of our controls.

Regards,
Tanya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Grigory
Top achievements
Rank 2
answered on 19 May 2015, 06:22 PM

Hello Tanya,

 

Thank you for trying to help me with my issue.

I've finally found out the reason of the problem. I used the old telerik libraries (I don't have license for the latest ones). However, I checked this issues with the actual libraries in test mode, and it works. Probably, there were a bug in the old ones.

 

Regards,

Grigory

Tags
RichTextBox
Asked by
Grigory
Top achievements
Rank 2
Answers by
Tanya
Telerik team
Grigory
Top achievements
Rank 2
Share this question
or