WPF ,listbox,平滑滚动的2种方式。

一,烤地瓜版本的。。  这个版本不安装内容滚动,,鼠标滑轮滚动一次距离相同,

  具体步骤参照他的博客,说点注意的,,

1,ScrollViewer.CanContentScroll="False"

2,容器模版虚拟化StackPanel换成非虚拟的。

<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<StackPanel IsItemsHost="True"/>
		</ItemsPanelTemplate>

  二,安装内容滚动,,滑轮滚动一次,listbox移动3项,体验没有一的好。。。ScrollViewer.CanContentScroll="True"

 <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
            <VirtualizingStackPanel IsItemsHost="True">
                <i:Interaction.Behaviors>
                    <ei:FluidMoveBehavior AppliesTo="Children"/>
                </i:Interaction.Behaviors>
            </VirtualizingStackPanel>
        </ItemsPanelTemplate>

   很简单的效果,,,下载Demo

原文地址:https://www.cnblogs.com/m7777/p/4701158.html