如何在 Viewbox 内垂直滚动 ItemsControl?
如果将 ItemsControl 放置在视图框中,如何让 ItemsControl 垂直滚动?
<Viewbox>
<ItemsControl ItemsSource="..." />
</Viewbox>
我需要 Viewbox 将 ItemsControl 的所有内容水平缩放到手机的宽度(Viewbox 完美地做到了这一点,它以这样的方式缩放内容,使 ItemsControl 的最宽行恰好占据宽度,等于手机宽度) 。但现在由于某种原因我无法垂直滚动列表,我尝试了 ScrollViewer、Viewbox 的滚动条、ItemsControl 的滚动条 - 没有任何效果。
How to let ItemsControl scroll vertically, if it's placed in a viewbox?
<Viewbox>
<ItemsControl ItemsSource="..." />
</Viewbox>
I need the Viewbox to scale all the content of my ItemsControl horizontally to the width of the phone (Viewbox does it perfectly, it scales the content in such a way that the widest row of ItemsControl occupies exactly the width, equal to the phone width). But now I cannot scroll the list vertically for some reason, I tried ScrollViewer, scrollbars of Viewbox, scrollbars of ItemsControl -- nothing works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ViewBox
测量其内容,然后对其进行转换,使其完全适合可用空间。这将消除对滚动条的需要!考虑到手机的屏幕尺寸是固定的,
ViewBox
通常是多余的。为什么不直接设置明确的大小呢?A
ViewBox
measures its contents, then transforms it so that it fits perfectly within the space available. This will remove the need for scrollbars!Considering that phones have a fixed screen size, the
ViewBox
is often redundant. Why not just set an explicit size?