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

Devi
  • 1
  • 5
  • `` - Set the document's PageWidth to a BIG number. This looks like the only option. Why you don't want to set PageWidth ? https://stackoverflow.com/questions/1368047/c-wpf-disable-text-wrap-of-richtextbox/1369184#1369184 – Subbu Jul 14 '17 at 07:38
  • 1
    Possible duplicate of [C#/WPF: Disable Text-Wrap of RichTextBox](https://stackoverflow.com/questions/1368047/c-wpf-disable-text-wrap-of-richtextbox) – L. Guthardt Jul 14 '17 at 07: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 Jul 14 '17 at 09:20
  • https://stackoverflow.com/questions/1368047/c-wpf-disable-text-wrap-of-richtextbox – Kundan Bhati Jul 14 '17 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. – Mike Strobel Sep 05 '17 at 12:56

1 Answers1

0

Third partycontrol syncfusion control SfRichTextBoxAdv has a solution for this issue

Devi
  • 1
  • 5