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

ChangeListStyle changes spacing

3 Answers 54 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Elijah
Top achievements
Rank 1
Elijah asked on 25 Aug 2014, 08:38 PM
I have a RTB setup to contain free form text users enter.  I'm using the RichTextProvider.  They have some of the basic font controls from the sample available such as Bold, Italic, Underline, colors, etc.  They are also able to do Bullet and Number lists.

When changing the list style to the appropriate type, it changes the spacing as well.  In the attached image, you can see where I:
1) Type "This is a test."
2) Hit enter
3) Type "This is a new line."
4) Hit enter
5) Click the 'Bullet list' button which initiates a ChangeListStyle with DefaultListStyles.Bulleted
6) Type "Bullet clicked"
7) Hit enter
8) Type "New line in bullet list"
9) Hit enter
10) Click the 'bullet list' button which initiates a ChangeListStyle with DefaultListStyles.None
11) Type "Out of bullet"

As you can see, the bullet spacing is not the same as the lines before or after.

How can I keep the spacing the same?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Aug 2014, 01:08 PM
Hello Elijah,

Thank you for writing.

You can modify the paragraph line spacing when the DefaultListStyles.Bulleted is applied to display the line spacing equal between normal and bullet rows:
private void radToggleButton1_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
    ListStyle style = DefaultListStyles.None;
    float spacing = 0f;
    if (args.ToggleState == ToggleState.On)
    {
        style = DefaultListStyles.Bulleted;
        spacing = 1.0f;
    }
    else
    {
        spacing = 1.15f;
    }
     
    this.radRichTextBox1.DocumentView.ChangeParagraphLineSpacing(spacing);          
    this.radRichTextBox1.ChangeListStyle(style);
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
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
Elijah
Top achievements
Rank 1
answered on 02 Oct 2014, 01:14 PM
This worked, thank you.  I do have another question however.  Is there a way to enforce the spacing for the entire document?  Say I wanted to keep the before and after spacing at .8.  That's when loading content, the user is adding content, hitting enter, bullets, etc.

Is there a way to do that?  Right  now I'm running into some really funky formatting issues.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Oct 2014, 08:32 AM
Hello Elijah,

Thank you for writing back.

You can affect the spacing for the entire document via selecting the whole document content and calling the ChangeParagraphLineSpacing method passing the desired spacing as a parameter:
radRichTextBox1.Document.Selection.SelectAll();
radRichTextBox1.ChangeParagraphLineSpacing(2);
radRichTextBox1.Document.Selection.Clear();

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Desislava
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Elijah
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Elijah
Top achievements
Rank 1
Share this question
or