I would like to have an animation when an item in ListView changes position, so it would slowly move to the new position. Either in a template or in code. I've tried descending from a (Virtualizing)StackPanel and overriding ArrangeOverride to reposition and animate the items. the problem is that I don't know at what position the item was 'before' the update so I could transition to the new position nicely. I tried checking the TranslateTransform of the item, storing in a dictionary, overriding OnItemChanged and storing OldPosition/Position .. but none of there work because it seems the items are always recreated (from template). Any other suggestions? thank you!
A:
I realise that it is not exactly what you are after, but if you can't find anything better you could have a look at Josh Smith's article http://joshsmithonwpf.wordpress.com/2007/03/13/animated-filtering-of-listboxitems/
Greg Bacchus
2009-08-25 09:15:17
+3
A:
Use FluidMoveBehavior behaviour , it will make you life lot easier.
you can apply this to any itemscontrol in the following manner
<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 behaviour in the Microsoft.Expression.Interactions.dll that is installed along with Blend 3
rravuri
2009-09-01 10:00:35
Do you have a link to the documentation of FluidMoveBehavior? I can't seem to find anything.
Ray
2009-09-08 21:27:57
Limited class documentation can be found in the Expression Blend SDK Userguide that is installed along with Blend 3
rravuri
2009-09-09 06:19:28
thanks for all answers .. this method with behaviors looks nice, but the problem is that all of the items are recreated and thus all are animated into position (from the top). same problem applies to all other solutions.I will look into using a DataGrid instead as it seems to have a few other things I would like.
Lee_Nover
2009-09-09 11:37:01
+1
A:
Hey Lee,
In fact this problem was perfectly solved by Dan Crevier back in 2006. Check out his PanelLayoutAnimator class.
Anvaka
2009-09-01 17:26:38
+1. I just checked this article out -- it involves a single class, the code sample was easy to understand, using it only involves adding a single attribute to your XAML and the result looks good. Recommended.
Drew Noakes
2009-10-08 12:37:42
A:
Maybe this article by Matthias Shapiro would help: How To Create An Animated ScrollViewer (or ListBox) in WPF
Ray
2009-09-08 21:25:29