I'm trying to display image results on a StackPanel, and scroll through the results. However the height of the ScrollViewer is set to the height of the StackPanel instead of the available space in the Window.
<Grid x:Name="maingrid" Background="#222">
<StackPanel>
<Grid>
<!--Search bar and stuff-->
</Grid>
<Grid>
<ScrollViewer>
<StackPanel x:Name="resultsparent" VerticalAlignment="Top" HorizontalAlignment="Stretch" Width="1025">
</StackPanel>
</ScrollViewer>
</Grid>
</StackPanel>
</Grid>
I tried to set the height of the ScrollViewer manually and it works, but I don't know how to make it automatically match the borders and I'd like some help on this please.
EDIT: It works with a DockPanel instead of the StackPanel, but it's horizontal and I can't see the Orientation property.