WPF RichTextBox prohibit line wrapping

Source: Internet
Author: User

This problem has been troubled for a long time, into the continuous efforts, finally solved

<richtextbox margin= "0,44,10,0" name= "Codetext" verticalscrollbarvisibility= "Auto" Horizontalscrollbarvisibility= "Auto" horizontalalignment= "right" verticalalignment= "Top" width= "494" Height= "435" >
<RichTextBox.Resources>
<style targettype= "{x:type Paragraph}" >
<setter property= "Margin" value= "0"/>
</Style>
</RichTextBox.Resources>
<RichTextBox.Document>
<flowdocument pagewidth= "2048" >
</FlowDocument>
</RichTextBox.Document>
</RichTextBox>

The red is the solution, here my idea is to set the width of 2048, so that when the length of 2048 will be changed line, you can certainly set the larger, but there is a flaw is the scroll bar has been there. Please leave a message if you solve the scroll bar problem.

Close-up note: The 2048 here is actually a bits number, which means that when you write 256 characters (256*8=2048) in a row, the line will be wrapped

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.