WPF RichTextBox 水平滚动不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32218909/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:21:54  来源:igfitidea点击:

WPF RichTextBox horizontal scroll not working

wpfscrollbarscrollviewrichtextbox

提问by itzmebibin

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

在我的 wpf 应用程序中,我使用的是富文本框。它的垂直滚动条工作正常。但它的水平滚动条不起作用。

HorizontalScrollBarVisibility="Auto"

It is not giving proper results. Please help me.

它没有给出正确的结果。请帮我。

回答by Matt Wilkinson

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.

您的文本框正在包装内部内容,这是 RichTextBox 控件的默认设置。如果您希望明确启用它可滚动,您可以执行类似于此 StackOverflow 问题的操作

回答by M Komaei

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

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

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

Horizo​​ntalScrollBar :Horizo​​ntalScrollBarVisibility="Auto" MaxWidth="400"

回答by Sumit

WPF Property of ScrollBar property can be changed by

可以通过以下方式更改 ScrollBar 属性的 WPF 属性

richtextbox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;