0

I am using RichTexbox to display RTF text in my application, depends on windows width RichTextbox text auto wraps to next line!!

I want to disable the text auto warp, instead i want to display scroll bar, Also i don't want to set PageWidth of the FlowDocument to avoid text wrapping (since am displaying RTF text i cant measure the PageWidth based on character/size/Font/Font style of the text because each and every character may contains different font style and size)

 <RichTextBox HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">      
   <FlowDocument >
        <Paragraph>
            <Run Text="RichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBoxRichTextBox"/>
        </Paragraph>
   </FlowDocument>

Is there any other existing property is there to control auto wrapping or can we handle this without measure text size

I have already discussed about this in MSDN forum also reffered existing stackflow disussions WPF RichTextBox word wrapping and Wpf RichTextBox wrapping problems

Thank you

Santhosh Devi

5
  • <FlowDocument PageWidth="10000"> - Set the document's PageWidth to a BIG number. This looks like the only option. Why you don't want to set PageWidth ? stackoverflow.com/questions/1368047/…
    – Subbu
    Commented Jul 14, 2017 at 7:38
  • 1
    Possible duplicate of C#/WPF: Disable Text-Wrap of RichTextBox Commented Jul 14, 2017 at 7:48
  • 1
    I have already tried by assigning PageWidth to a big value but the HorizontalScrollbar is always visible and when i scroll horizontally empty page is scrolling, also there is a chance to text wrap if the bigdata is binded to it. Thats why am not convinced to set big number to pagewidth...
    – Devi
    Commented Jul 14, 2017 at 9:20
  • stackoverflow.com/questions/1368047/… Commented Jul 14, 2017 at 11:32
  • If you are displaying potentially large chunks of text, a FlowDocument is perhaps not the best choice (though it is certainly better than FixedDocument). If you're displaying content with excessively long lines, the document layout/formatting costs may add up significantly as the document grows in size. Alas, a FlowDocument is what you get when you use a RichTextBox. If you must display RTF content, you may not have much of a choice. But if we knew more about what you are displaying, perhaps we could offer a more appropriate alternative. Commented Sep 5, 2017 at 12:56

1 Answer 1

0

Third partycontrol syncfusion control SfRichTextBoxAdv has a solution for this issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.