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

spacing between the lines

1 Answer 256 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
efi
Top achievements
Rank 1
efi asked on 19 Jul 2011, 11:11 AM
Hi

i'm tring to change the spacing between lines in wpf RadRichText control. i've already tried the

ChangeParagraphSpacingAfter methode but it works only for empty data but when i load exsisting data
it return again with spaces.
my code look like:

private void rtfMain_Loaded(object sender, RoutedEventArgs e)
       {
           this.rtfControlMain.ChangeParagraphSpacingAfter(0);
           this.rtfControlMain.ChangeParagraphLineSpacing(1.15);
        }

xaml:

<telerik:RadRichTextBox x:Name="rtfControlMain"
                                ToolTip="{Binding ElementName=rtfControl,Path=Text}"
                                IsReadOnly="{Binding ElementName=rtfControl,Path=IsReadOnly}"
                                IsSelectionMiniToolBarEnabled="{Binding ElementName=rtfControl,Path=IsReadOnly, Converter={StaticResource inverseBooleanConverter}}"
                                FontFamily="Segoe UI" FontSize="11" DocumentInheritsDefaultStyleSettings="True" Grid.Row="2"  Loaded="rtfMain_Loaded">
            <telerik:RadRichTextBox.Resources>
                <Style TargetType="TextBlock" />
            </telerik:RadRichTextBox.Resources>
           
            <telerik:RadRichTextBox.Document>
                <telerik:RadDocument LineSpacing="1.15" ParagraphDefaultSpacingAfter="0"   />
            </telerik:RadRichTextBox.Document>
        </telerik:RadRichTextBox>

Please suggest how can i control this spacing.
Thanks,



1 Answer, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 21 Jul 2011, 02:11 PM
Hello Efi,

This command operates on the selected paragraphs (or if there is no selection, the paragraph which contains the caret). If you want to change the line spacing a spacing after of all paragraphs, you should use
this.rtfControlMain.Document.Selection.SelectAll();
This will select the entire document and then the changes will be applied to every paragraph.

Kind regards,
Ivailo
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
RichTextBox
Asked by
efi
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Share this question
or