Silverlight Vertical 只有 ScrollViewer? [英] Silverlight Vertical only ScrollViewer?

查看:40
本文介绍了Silverlight Vertical 只有 ScrollViewer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法创建一个只允许内容垂直滚动的 ScrollViewer?水平(宽度)必须以与 StackPanel 的宽度受限于其父级(当 Horizo​​ntalAlignment=Stretch 时)相同的方式进行约束.

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).

我有一个可调整大小的窗口,其中包含我希望允许垂直滚动的内容.该窗口包含一个 ScrollViewer.里面有很多TextBoxs(一种数据输入表格).当我在 TextBox 中键入大量文本时,控件只会向右增长,并离开窗口.如果我使用 StackPanel 而不是 ScrollViewer,那么无论文本中有多少文本,TextBox 的大小都保持不变.(但没有垂直滚动).

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.

所以基本上我想限制 ScrollViewer 在水平方向上增长.

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

谢谢

推荐答案

尝试设置

<ScrollViewer HorizontalScrollBarVisibility="Disabled">

这篇关于Silverlight Vertical 只有 ScrollViewer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆