Animate a WP7 data item when first added to the list

Hi everyone, I am trying to apply animation to any element that is added to a datatemplate in a WP7 subset of silverlight. However, I have some problems. Although this seems quite possible in WPF ( Animate WPF Datatemplate when an item is added to the Listbox? ) Using a DataTemplate.Triggers, WP7 silverlight does not have the Triggers property for DataTemplates, So how will I do it on winphone?

+5
source share
2 answers

I assume you have DataTemplateone that is used as the value of a property ListBox.ItemTemplatein XAML? If so, you should be able to handle the event Loadedin the root element DataTemplatein the code behind. This event will be triggered as each instance is created DataTemplate, allowing you to run Storyboard.

+3
source

Silverlight 4 added the LayoutStates concept to the ListBoxItem control, this allowed you to add animation for state transitions, including things like BeforeLoaded to AfterLoaded. Unfortunately, this functionality is not baked in WP7 (based on Silverlight 3).

There are some workarounds until changes to the Mango release, including the ColinE solution, are mentioned.

: # WP7 ListBoxItems / # 3: Windows Phone 7

+2

All Articles