<Window x:Class="WpfApplication1.Window23" > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > Title="ScrollViewer Test"> > <StackPanel > > <ScrollViewer HorizontalScrollBarVisibility="Auto"> > <Rectangle Width="500" Height="500" Fill="Red" /> > </ScrollViewer> > </StackPanel> ></Window>>When I run this and make the window narrower then the horizontal scrollbar kicks in when required. If, however, I reduce the height of the window then the minimum height of the StackPanel (and ScrollViewer) is constrained by the height of the Rectangle (if I switch the Orientation of the StackPanel I get the opposite behaviour (i.e vertical Scrollbar works) )
<Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ScrollViewer Test" Name="myWindow"> <Grid Name="myGrid"> <StackPanel> <ScrollViewer HorizontalScrollBarVisibility="Auto" Height="{Binding Path=ActualHeight, ElementName=myGrid }" > <Rectangle Width="500" Height="500" Fill="Red" /> </ScrollViewer> </StackPanel> </Grid> </Window>That's probably is not worth using, but it show one way to work around it. The basic fix is to set the height for the scroll viewer to the desired size. You could also add a converter to the binding if for instance you wanted the scroll viewer to take up 30% of the space of the grid.