WP7 防止列表框滚动

WP7 Prevent ListBox scrolling(WP7 防止列表框滚动)
本文介绍了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.Horizo​​ntalScrollBarVisibility="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 防止列表框滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)