private void RecordListControl_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { try { if (e.Action == NotifyCollectionChangedAction.Add) { RecordList.UpdateLayout(); var listBoxItem = this.RecordList.ItemContainerGenerator.ContainerFromIndex(0) as ListViewItem; if (Orient == Orientation.Horizontal) { var animation = new DoubleAnimation() { Duration = TimeSpan.FromMilliseconds(500), From = -listBoxItem.Width }; Storyboard.SetTarget(animation, listBoxItem); Storyboard.SetTargetProperty(animation, new PropertyPath("RenderTransform.X")); storyboard.Children.Add(animation); } else if (Orient == Orientation.Vertical) { var animation = new DoubleAnimation() { Duration = TimeSpan.FromMilliseconds(500), From = -listBoxItem.Height }; Storyboard.SetTarget(animation, listBoxItem); Storyboard.SetTargetProperty(animation, new PropertyPath("RenderTransform.Y")); storyboard.Children.Add(animation); } storyboard.Begin(); } else if (e.Action == NotifyCollectionChangedAction.Remove) { storyboard.Children.RemoveAt(0); } } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); } }