Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The ScrollViewer does not scroll

I would like to have an interface with 3 components one next to the other. The first would be a ListView and the two others being Grids.

Since the components will overflow on the right, I want to put them in a ScrollViewer. I did not succeed. I tried to do a really simple example to try, but even the example fails.

    <ScrollViewer Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
        <StackPanel Width="1200" Height="400" Orientation="Horizontal">
            <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top"  />
            <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
        </StackPanel>
    </ScrollViewer>

As you can see, the ScrollViewer is Inside a Grid. What did I miss?

like image 285
Jonas Schmid Avatar asked Apr 26 '12 11:04

Jonas Schmid


1 Answers

Try settings these properties on the scroll viewer:-

 <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" ZoomMode="Disabled" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
    <StackPanel Width="1200" Height="400" Orientation="Horizontal">
        <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top"  />
        <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
        <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
    </StackPanel>
</ScrollViewer>

That works for me normally!

like image 120
Ross Dargan Avatar answered Oct 13 '22 21:10

Ross Dargan