gpt4 book ai didi

wpf - ItemsControl 缺少垂直滚动条

转载 作者:行者123 更新时间:2023-12-04 01:35:04 29 4
gpt4 key购买 nike

我有以下 ItemsControl它完美地包裹了元素,但它没有垂直滚动条来查看包裹的元素。如何让滚动条显示?

    <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默认不包装 ItemsPresenterScrollViewer所以你必须像这样手动完成:

<ScrollViewer Grid.Column="0" Grid.Row="1">
<ItemsControl x:Name="tStack" ... >
<!-- .... -->
</ItemsControl>
</ScrollViewer>

关于wpf - ItemsControl 缺少垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18397839/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com