(WPF) ListView animation moving an item

I would like to have animation when an item in a ListView changes position, so it will slowly move to a new position. Either in the template or in the code. I tried to go down from (StringPanel) virtualization and override ArrangeOverride to move and animate elements. the problem is that I donโ€™t know in what position the item was โ€œbeforeโ€ the update, so that I can move well to the new position. I tried checking the TranslateTransform of the element, storing it in the dictionary, overriding OnItemChanged and storing OldPosition / Position .. but none of them work because it seems that the elements are always recreated (from the template).

Any other suggestions?

+7
listview animation wpf
source share
4 answers

Use the behavior of FluidMoveBehavior, this will make your life easier.

You can apply this to any controls as follows.

<ItemsPanelTemplate x:Key="ItemsPanelTemplate"> <WrapPanel> <i:Interaction.Behaviors> <il:FluidMoveBehavior AppliesTo="Children" Duration="00:00:00.75"/> </i:Interaction.Behaviors> </WrapPanel> </ItemsPanelTemplate> 

you can find this behavior in Microsoft.Expression.Interactions.dll, which is installed with Blend 3

+7
source share

In fact, this problem was completely resolved by Dan Krever back in 2006. Check out its PanelLayoutAnimator class.

+1
source share

I understand that this is not exactly what you need, but if you canโ€™t find anything better, you could take a look at Josh Smith's article http://joshsmithonwpf.wordpress.com/2007/03/13/animated-filtering- of-listboxitems /

0
source share

@ Rravuri's answer works for me, you should define it as a dynamic resource that you can apply directly, and then call it liketis ItemsPanel = "{DynamicResource ItemsPanelTemplate}"

0
source share

All Articles