如何将滚动条添加到 wpf c# 中的文本框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36756935/
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
How do I add a scrollbar to a textbox in wpf c#
提问by John Douglas
I know it's pretty easy with windows forms but I have to use a wpf application so it's probably harder as I can't seem to find anything. Thanks
我知道使用 Windows 窗体很容易,但我必须使用 wpf 应用程序,所以它可能更难,因为我似乎找不到任何东西。谢谢
回答by Nejc Galof
The HorizontalScrollBarVisibilityand VerticalScrollBarVisibilityproperties are used to set horizontal and vertical scroll bars of a TextBox, The ScrollBarVisibility enumeration has four values – Disabled, Auto, Hidden, and Visible.
的HorizontalScrollBarVisibility和VerticalScrollBarVisibility属性用于设置TextBox的水平和垂直滚动条,所述ScrollBarVisibility枚举有四个值- ,Disabled,Auto,Hidden和Visible。
<TextBox Name="TextBox"
Width="300" Height="150"
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
TextWrapping="Wrap" >
</TextBox>

