As titled, how can I do that?
I have been reading some Silverlight/WPF animation tutorial, most of them are only teaching how can you animate a Control against different property and animation…
Say, if I dynamically add MyUserControl into a ListBox, how can I make the MyUserControl appears in the ListBox animated? (i.e fading inside, size from 0% to 100% in the list etc.)
I know in code-behind, I can focusly to do such a thing as follow pseudo code:
ListBox myListBox;
MyUserControl myUC;
myListBox.Items.Add(myUC);
//Trigger animation against myUC
But what I mean is, I am looking for something that I can use to apply on to the MyUserControl. So no matter where this MyUserControl add into (i.e Grid, TabControl, ListBox, TreeView etc), it plays an animation when it appears.
Is this possible? Either in Xaml or code-behind.
P.S. Explaination for dummy would be great, I have more experience onn animating control in code-behind rather than xaml.
In the
UserControldefinition you can add aTriggerfor theLoadedevent, upon which you can start the necessary animations via aStoryboard. If you prefer code-behind you can add aLoadedevent handler and start some animations there.