WPF - ScrollView 混乱 [英] WPF - ScrollView Confusion

查看:41
本文介绍了WPF - ScrollView 混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 WPF 的新手,ScrollViewer 让我很沮丧.要么我只是没有得到"它,要么它是一种有限的控制.

I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control.

这是我的挫折:

  1. Bad Horizo​​ntal Scrolling 水平滚动条仅在列表底部可见(我必须滚动到底部才能看到)

  1. Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it)

Bad Borders 我的 ScrollViewer 中有一个 ListBox.当我开始时,列表底部没有边框,当我向下滚动时,列表框的顶部边框(线)消失了.我可以理解这一点,但是尝试为 ScrollViewer 设置 BorderThickness 或 BorderBrush 结果没有任何变化(我想使用 ScrollViewer 的边框来在列表内容周围保持一个恒定框,就像网络世界中的大多数列表框一样).

Bad Borders I have a ListBox in my ScrollViewer. When I start the bottom of the list has no border and when I scroll down, the top border (line) of the list box disappears. I can kind of understand this, but attempts to set BorderThickness or BorderBrush for the ScrollViewer result in no change (I wanted to use the ScrollViewer's border to keep a constatant box around the list contents, like most list boxes out in cyber world).

短列表处理不当 当列表中的项目没有到达底部时,ScrollViewer 将滚动条保持在那里,只是将其抖动.为什么不释放一些空间并将其删除?

Bad Handling of Short Lists When the items in the list don't reach the bottom the ScrollViewer keeps the scroll bar there and just dithers it out. Why not free up some space and remove it?

其中一些可能看起来很小(而且确实如此).但是用户希望他们的应用程序具有某种外观和感觉,而 WPF 使其难以开箱即用.

Some of these may seem petty (and they are). But users expect a certain look and feel from their apps and WPF is making it hard to get this out of the box.

如果您知道解决这些问题的方法,我希望得到回复.如果有比使用 ScrollViewer 更好的方法来处理滚动,那也是受欢迎的.

If you know a way to fix any of these I would love a response. If there is a better way to deal with scrolling than using the ScrollViewer that would aslo be welcome.

推荐答案

  1. 也许您看到的是列表内部的一些滚动条,而不是 ScrollViewer 的滚动条?尝试设置 <ScrollViewer ... Horizo​​ntalScrollBarVisibility="Auto">(默认为 Hidden,这意味着永远不会显示水平滚动条;也尝试可见"为了调试)

  1. Maybe you see some scroll bar from inside the list rather than the scroll bar from the ScrollViewer? Try setting <ScrollViewer ... HorizontalScrollBarVisibility="Auto"> (default is Hidden, which means that no horizontal scroll bar is shown ever; also try "Visible" for the sake of debugging)

在 ScrollViewer 周围放置 是一种选择吗?

Is putting a <Border> around the ScrollViewer an option?

VerticalScrollBarVisibility 的默认值为 Visible.如果您希望滚动条在不需要时消失,请尝试 <ScrollViewer ... VerticalScrollBarVisibility="Auto">.

VerticalScrollBarVisibility has a default value of Visible. If you want the scroll bar to disappear when it is not necessary, try <ScrollViewer ... VerticalScrollBarVisibility="Auto">.

这篇关于WPF - ScrollView 混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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