Silverlight 4 Transition Animations Between Adding/Removing Grid Child Elements
I'm using the Silverlight Wizard control provided by this blog:
http://weblogs.asp.net/bryansampica/archive/2010/07/21/silverlight-4-0-wizard-custom-control.aspx
And I would like to add a transition between ActivePage changes...the way they are handled in the codebehind are like so:
public void manager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
ContentHost.Children.Clear();
ContentHost.Children.Add(manager.ActiveStep);
HeaderText = manager.开发者_如何学CActiveStep.StepHeaderText;
}
Is there any way to add an animation between the Clear & Add?
My apologies if this is a silly question!
Thanks!
One way to get the desired effect would be to launch a Storyboard which handles the visual transition, then listen on the Completed event to update the ContentHost.Children.
- In a storyboard animate ContentHost.Opacity to 0
- When the Storyboard.Completed event fires, execute the code in your manager_PropertyChanged() code block
- Launch a second Storyboard to animate ContentHost.Opacity back to 1
精彩评论