我在 wpf 中有一个围绕 ItemsControl 的滚动条,仅当列表长于窗口大小时才可见。但是,当它被隐藏时,滚动条应该在的地方有一个空白区域。
如何删除此空间并“折叠”滚动条?
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Top"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding Path=ContactGroups}"
Width="Auto"
MinWidth="231"
MinHeight="342"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Height="Auto"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Top"
HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<c:ContactGroupControl />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>