Question

I'm trying to make my scroll viewer scroll flawlessly, that is I have a scrollviewer and it contains a stackpanel , the stack panel contains a user-made user control. and they can increase or decrease dynamically at run time.

the problem is, suppose i have only 2 user controls in my stack panel , the scroll viewer have only 2 levels of scrolling, so it scrolls a whole user control for each click or mouse-wheel movement.

how can I change that? is it a property or there is a mistake in the design?

here is the xaml code for it:

<ScrollViewer HorizontalAlignment="Left" Height="420" VerticalAlignment="Top" Width="862" Margin="0,0,-2,0" CanContentScroll="True" PanningRatio="0.1">
                <StackPanel x:Name="hpList" HorizontalAlignment="Left" Height="422" VerticalAlignment="Top" Width="843"/>
            </ScrollViewer>

and the stack panel expands or shrinks dynamically.

Was it helpful?

Solution

set CanContentScroll="False" and remove the stackpanel height\width

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top