开发者

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.

  1. In a storyboard animate ContentHost.Opacity to 0
  2. When the Storyboard.Completed event fires, execute the code in your manager_PropertyChanged() code block
  3. Launch a second Storyboard to animate ContentHost.Opacity back to 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜