这里我们使用Storyboard来动态显示ListView元素位置的更改,效果如下(与采用FluidMoveBehavior方式实现的区别是前面几个图片的加载效果,后面的滚动消失效果基本一致):
实现步骤:
1、图片资源绑定类ListBindData.cs与方式一中的相同,不再赘述。
2、图片滚动效果是采用Storyboard改变ListViewItem的RenderTransform属性来实现的。
窗体xaml:
<Window x:Class="SmoothScroll.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
<Window.Resources>
<!--ListView样式-->
<Style x:Key="ListViewItemStyle" TargetType=