WP7 防止列表框滚动

3

本文介绍了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 防止列表框滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14

具有未知类型的 CreateDelegate
CreateDelegate with unknown types(具有未知类型的 CreateDelegate)...
2023-11-11 C#/.NET开发问题
5

Func&lt;T&gt;.BeginInvoke 使用线程池吗?
Does Funclt;Tgt;.BeginInvoke use the ThreadPool?(Funclt;Tgt;.BeginInvoke 使用线程池吗?)...
2023-11-11 C#/.NET开发问题
6

如何为具有空目标的实例方法创建委托?
How to create a delegate to an instance method with a null target?(如何为具有空目标的实例方法创建委托?)...
2023-11-11 C#/.NET开发问题
6