ListView CustomRoutedEvent to Trigger Animation on row?

I do not think this belongs into the ItemContainerStyle since the item management is at the higher level of the ListView itself.

I do not think this belongs into the ItemContainerStyle since the item management is at the higher level of the ListView itself. One way you can approach this is by using a behavior from the Blend SDK, e.g. : xmlns:i="schemas.microsoft.com/expression/2010/in... class FlashNewRowBehavior : Behavior { protected override void OnAttached() { base.OnAttached(); AssociatedObject. Loaded += new System.Windows.

RoutedEventHandler(AssociatedObject_Loaded); } void AssociatedObject_Loaded(object sender, System.Windows. RoutedEventArgs e) { var itemsSource = AssociatedObject. ItemsSource; if (itemsSource is INotifyCollectionChanged) { var collection = itemsSource as INotifyCollectionChanged; collection.

CollectionChanged += (s, cce) => { if (cce. Action == NotifyCollectionChangedAction. Add) { // This code sadly is rather unclean, some wait is necessary or the ItemContainerGenerator will return null Wait(TimeSpan.

FromSeconds(0.01)); var itemContainer = AssociatedObject. ItemContainerGenerator. ContainerFromItem(cce.

NewItems0) as ListViewItem; if (itemContainer! = null) { Storyboard sb = new Storyboard(); ColorAnimation anim = new ColorAnimation() { // From is not really needed (if you want to animate from the current background color at least) From = Colors. Navy, // I would create properties instead of hardcoded values To = Colors.

White, Duration = (Duration)TimeSpan. FromSeconds(0.4), AutoReverse = true }; Storyboard. SetTargetProperty(anim, new PropertyPath("Background.

Color")); Storyboard. SetTarget(anim, itemContainer); sb.Children. Add(anim); sb.Begin(); } } }; } } private static void Wait(TimeSpan timeout) { var frame = new DispatcherFrame(); new Thread((ThreadStart)(() => { Thread.

Sleep(timeout); frame. Continue = false; })).Start(); Dispatcher. PushFrame(frame); } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions