0

In my wpf application , i am using a richtextbox. Its vertical scrollbar is working fine. But its horizontal scrollbar is not working.

HorizontalScrollBarVisibility="Auto"

It is not giving proper results. Please help me.

itzmebibin
  • 8,738
  • 7
  • 46
  • 59

4 Answers4

0

Your text box is wrapping the inner contents which is a default for the RichTextBox Control. If you wish to explicitly enable it being scroll-able, you can do something similar to this StackOverflow Issue.

Community
  • 1
  • 1
Matt Wilkinson
  • 592
  • 2
  • 13
  • All long lines that exceed the width of RichTextBox have been auto-line breaked, and no horizontal scroll bar appears. – itzmebibin Aug 26 '15 at 09:12
0

VerticalScrollBar : VerticalScrollBarVisibility="Auto" MaxHeight="200"

HorizontalScrollBar : HorizontalScrollBarVisibility="Auto" MaxWidth="400"

M Komaei
  • 4,146
  • 2
  • 14
  • 23
0

When the VerticalScrollBarVisibility and the HorizontalScrollBarVisibility properties of the RichTextBox are set to Auto or Visible the scroll bar behavior depend on FlowDocument.MinPageHeight and FlowDocument.MinPageWidth values. By default these values is set to 0. Therefore the RichTextBox uses only vertical scroll bar to adjust the content of the FlowDocument. To be appearing the horizontal scroll bar set proper the FlowDocument.MinPageWidth value.

For example:

<RichTextBox ...
    HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >

    <FlowDocument ...
        MinPageWidth="400" >

        <!-- FLOW DOCUMENT CONTENT HERE... -->

    </FlowDocument>
</RichTextBox>
Victor
  • 5,142
  • 4
  • 12
  • 29
-1

WPF Property of ScrollBar property can be changed by

richtextbox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
Sumit
  • 1