将 ListView 滚动条移至 GridViewColumnHeaders 下方
我试图弄清楚如何获取 ListView 中的垂直 ScrollBar 以清除 GridViewColumnHeaders。谁能给我一些从哪里开始的想法?谢谢。
I'm trying to figure out how to get the vertical ScrollBar in a ListView to clear the GridViewColumnHeaders. Can anyone give me some ideas of where to start? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到 3 个选项...
手动将标题创建为 ListView 顶部的网格,并隐藏 ListView 的标题。
重写ListView的
ControlTemplate
使用
DataGrid
而不是ListView< /code>
对于#1,您需要创建一个 DockPanel,其中包含标题顶部的网格,和列表视图占用剩余空间。您必须指定每列的宽度才能正确排列它们,并确保隐藏 ListView 标题。
对于#2,您可以使用 Expression Blend 等工具为 ListView 添加默认的 ControlTemplate,并对其进行更改,以便 ScrollBar 不会包裹 Header 项。
对于 #3,只需使用
VerticalScrollBarVisibility=Auto
切换到 DataGrid我个人的偏好是 #3。事实上,我认为我从来没有使用过 ListView...:)
I see 3 options...
Manually create the Header as a Grid on top of the ListView, and hide the ListView's header.
Rewrite the ListView's
ControlTemplate
Use a
DataGrid
instead of aListView
For #1, you'll want to create a DockPanel containing a Grid along the top for the Header, and the ListView taking up the remaining space. You'll have to specify how wide each column is going to be to line them up correctly, and be sure to hide the ListView headers.
For #2, you can use a tool such as Expression Blend to extra the default ControlTemplate for a ListView, and alter it so that the ScrollBar does not wrap the Header items.
For #3, simply switch to a DataGrid with
VerticalScrollBarVisibility=Auto
My personal preference is #3. In fact, I don't think I have ever even used a ListView... :)