I have a scrollbar in wpf around a ItemsControl, which is only visible when the list is longer than the window size. However, when it is hidden, there is a blank white space where the scrollbar should be.
How can I remove this space and "collapse" the scrollbar instead?
<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>