Silverlight Vertical only ScrollViewer?

无人久伴 提交于 2019-12-23 07:19:28

问题


Is there a way to create a ScrollViewer which only allows content to scroll vertically? The horizontal (width) must be constrained in the same manner as a StackPanel's width is constrained to its parent (when HorizontalAlignment=Stretch).

I have a resizable window which contains content I want to allow to scroll vertically. The window contains a ScrollViewer. Inside there is a lot of TextBoxs (a data entry form). When I type lots of text in a TextBox, the control just keeps growing to the right, and off the window. If I use a StackPanel instead of a ScrollViewer, then the size of the TextBox remains the same no matter how much text is in there. (but then no vertical scrolling).

I cant set a hard-coded Width because the window is resizable.

So basically I want to constrain the ScrollViewer from growing in the Horizontal direction.

Thanks


回答1:


Try setting

<ScrollViewer HorizontalScrollBarVisibility="Disabled">


来源:https://stackoverflow.com/questions/7682319/silverlight-vertical-only-scrollviewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!