使用FluidMoveBehavior来动态显示ListView元素位置的更改,这里实现的是图片横向动态滚动消失,效果如下:
实现步骤:
1、首先添加对Microsoft.Expression.Interactions.dll和system.windows.interactivity.dll的引用;
2、实现平滑滚动效果主要是在控件模板中加入以下代码:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal">
<i:Interaction.Behaviors>
<ei:FluidMoveBehavior AppliesTo="Children"/>
</i:Interaction.Behaviors>
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
窗体xaml:
<Window x:Class="DynamicExit.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://sch