WP7 Prevent ListBox scrolling(WP7 防止列表框滚动)
问题描述
我有一个包含两个 ListBox 控件的页面.该页面包含基于项目类别的项目列表.
I have a page with two ListBox controls. The page contains a list of items based on the item's category.
有一个类别的标题,后跟一个包含该类别所有项目的列表框,然后另一个标题跟随着该类别的项目列表,等等.
There is a header for a category, followed by a ListBox containing all items for that category, then another header followed a list of items for that category, etc.
我遇到的问题是每个 ListBox 都是独立滚动的.我希望整个页面滚动(它确实如此),但不是每个单独的 ListBox.ListBox 控件会根据其内容自动增长,因此无需滚动它们.这可能吗?
The issue I'm having is that each ListBox scrolls independently. I want the whole page to scroll (which it does), but not each individual ListBox. The ListBox controls grow automatically to their content, so there is no need to have them scroll. Is this possible?
推荐答案
要禁用滚动,您只需设置 ScrollViewer.VerticalScrollBarVisibility="Disabled"
(如果需要要禁用水平滚动,然后使用 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
).
All you have to do in order to disable the scroll is just to set ScrollViewer.VerticalScrollBarVisibility="Disabled"
(if you need to disable the horizontal scroll then use ScrollViewer.HorizontalScrollBarVisibility="Disabled"
).
这是一个简单的例子:
<ListBox Height="200" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBoxItem >
<Button Content="item1" />
</ListBoxItem>
<ListBoxItem >
<Button Content="item2" />
</ListBoxItem>
<ListBoxItem >
<Button Content="item3" />
</ListBoxItem>
<ListBoxItem >
<Button Content="item4" />
</ListBoxItem>
<ListBoxItem >
<Button Content="item5" />
</ListBoxItem>
</ListBox>
我希望这能回答你的问题.
I hope that this will answer your question.
这篇关于WP7 防止列表框滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:WP7 防止列表框滚动


- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01