ItemsControl缺少垂直滚动条 [英] ItemsControl missing vertical scrollbar
本文介绍了ItemsControl缺少垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下面的ItemsControl
,它可以完美地包裹物品,但是它没有垂直的滚动条来查看包裹的物品.如何显示滚动条?
I have the below ItemsControl
which wraps items perfectly but it does not have a vertical scrollbar to see the wrapped items. How can I get the scrollbar to show?
<ItemsControl x:Name="tStack" Grid.Column="0" Grid.Row="1"
ItemsSource="{Binding Shows.View}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
BorderThickness="0.5">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Left"
VerticalAlignment="Top"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Viewbox HorizontalAlignment="Left" Height="250">
<Controls1:MyShowsUserControl Padding="10"/>
</Viewbox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
推荐答案
ItemsControl
默认情况下不会将ItemsPresenter
包装在ScrollViewer
中,因此您必须像这样手动进行操作:
ItemsControl
by default does not wrap ItemsPresenter
in ScrollViewer
so you have to do it manually like so:
<ScrollViewer Grid.Column="0" Grid.Row="1">
<ItemsControl x:Name="tStack" ... >
<!-- .... -->
</ItemsControl>
</ScrollViewer>
这篇关于ItemsControl缺少垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文