所有你要做的,以禁用滚动只是设置
ScrollViewer.VerticalScrollBarVisibility="Disabled"
(如果需要禁用水平滚动,则使用
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>
我希望这能回答你的问题。