Smooth scroll within stackpanel in wpf

前端 未结 1 1595
有刺的猬
有刺的猬 2021-02-09 20:00

                

        
1条回答
  •  臣服心动
    2021-02-09 20:25

    Wrap your StackPanel in another panel

    WPF's ScrollViewer tries to scroll entire elements into view at a time, which is why you see the jumpy scroll behavior. By nesting the StackPanel in another Panel, the ScrollViewer will try and scroll the entire StackPanel into view, which is too big so it will use smooth scrolling.

    Here's an example - Removing the DockPanel will give you a jumpy scroll, but with it you'll get smooth scrolling behavior

    
        
            
                
                
                
                
                
                
            
        
    
    

    0 讨论(0)
提交回复
热议问题