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

LineSpacing + Text Selection

4 Answers 92 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 07 Mar 2013, 03:25 PM
Hello Telerik!

I did find in the formus similar problems, but i didnt find the solution i needed.
If I do this, to make line spacing look like in a microsoft notepad, i get problems with changing font size after that.

private void xamlDP_SetupDocument(object sender, Telerik.Windows.Documents.FormatProviders.SetupDocumentEventArgs e)
{
    e.Document.LineSpacing = 0.3;
}

Selection looks like on "screenshot.png".


How can I fix that?

4 Answers, 1 is accepted

Sort by
0
Oleg
Top achievements
Rank 1
answered on 08 Mar 2013, 09:46 AM
Also, automatic line wrapping works not right anymore (see screenshot2.png)

Are there other settings to make line spacing in all cases the same (0.3) ?
0
Oleg
Top achievements
Rank 1
answered on 11 Mar 2013, 02:13 PM
Dear Telerik,

Please provide me some information about this... I have a feeling that my posts are often ignored by your support...
0
Accepted
Iva Toteva
Telerik team
answered on 11 Mar 2013, 03:04 PM
Hi Oleg,

We try to monitor the forums, but an answer is by no means guaranteed. If you or your company has purchased a license for RadControls for Silverlight, you can refer to our FAQ section for information on how to get assigned as a license holder and use the support ticketing system.

As for your question, the line spacing is a parameter that specifies the spacing between lines in the same paragraph. Setting LineSpacing = 1 and LineSpacingType = Multiple (the default value) specifies that the line will be as high as 1 * the maximum word height in the line. That is why if you set it to a value less than 1, this will cause text to overlap and the selection will not show correctly.

If you want to set an exact value, say 15 pt, to be the line spacing, you could do so as follows:

e.Document.LineSpacingType = LineSpacingType.Exact;
e.Document.LineSpacing = Unit.PointToDip(15);

Again, if the height of the line is larger than 15 pt, the text will overlap.

Perhaps the property you are looking for is ParagraphDefaultSpacingAfter, which has a default value of 9pt and is the space between adjacent paragraphs? This one can be set to 0 and will simply cause no spacing between paragraphs.

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Oleg
Top achievements
Rank 1
answered on 11 Mar 2013, 03:13 PM
Thank you very much, that was exactly what i needed... and sorry for the "tone" :)

I will contact my "license holder" :)
Tags
RichTextBox
Asked by
Oleg
Top achievements
Rank 1
Answers by
Oleg
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or