C#/WPF: Disable Text-Wrap of RichTextBox

前端 未结 6 1550
醉酒成梦
醉酒成梦 2020-12-01 20:44

Does anyone know how I can disable the text wrapping of a RichTextBox? E.g. if I have a large string which doesn\'t fit in the window, the RichTextBox

6条回答
  •  自闭症患者
    2020-12-01 21:22

    I also needed to display a large string and tried the RichTextBox but I did not like the solution with setting the PageWidth of the Document to a fixed size. The scrollbar would be visible all the time and the scrolling area was be to big.

    If a TextBlock is sufficient you can use that instead and place it inside a ScrollViewer. It worked perfect for me since I did not need all the extra features of the RichTextBox.

    
                      
                          
                              Very long text Very long text Very long text 
                          
                      
    
    

提交回复
热议问题