Search code examples
androidwpfscrollscrollviewersmoothing

Any idea about WPF ScrollViewer to make it smooth scroolling like Android?


I have trying a simple ScrollViewer in xaml like below:

<ScrollViewer Height="{Binding RelativeSource={RelativeSource FindAncestor, 
     AncestorType={x:Type StackPanel}}, Path=Height}" ScrollViewer.VerticalScrollBarVisibility="Visible" CanContentScroll="True">
         <DockPanel>
             <StackPanel Name="StackPanel1" OverridesDefaultStyle="False" Width="230" Height="803"
                 VerticalAlignment="Top" HorizontalAlignment="Left" Margin="23,1,0,0">
             ....Something here
             ....Something here
             ....Something here
             </StackPanel>
         </DockPanel>
</ScrollViewer>

But my question is..is it possible for us to create any smooth scrolling likes any android or iphone using WPF?

Any ideas?


Solution

  • You would need to handle the MouseDown, MouseUp, MouseMove events yourself or the appropriate touch events yourself I would imagine.

    BTW, why are you using a relativeSource to get the height of the parent. Can't you just set the scroll viewer to fill the parent?