I have a ScrollViewer that contains an ItemsControl where the ItemsSource could have no elements. I want to prevent that the ScrollViewer change its height when the ItemsSource is empty without using a fixed value. This is the code:
<ScrollViewer
Grid.Row="1"
Grid.Column="1"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Disabled">
<ItemsControl
ItemsSource="{Binding ConsoleViewModel.AskTouchViewModel.ExperimentPresets}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:ExperimentPresetInProcedureViewModel">
<askTouch:ComposingProcedureItemView/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Orientation="Horizontal"
Margin="0 8 0 24"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
Does anyone have some idea to solve this problem? Thank you
