Windows 8 - BeginAnimation?

扶醉桌前 提交于 2019-12-10 03:16:53

问题


It seems I can't do myObject.BeginAnimation(dp , animation).

Is this a bug or has it been changed?


回答1:


You need to use a storyboard. Add your animation to the storyboard and have the storyboard begin the animation.

var storyboard = new Storyboard();

var opacityAnimation = new DoubleAnimation { 
    From = 0,
    To = 1,
    Duration = DurationHelper.FromTimeSpan(TimeSpan.FromSeconds(1)),
};
storyboard.Children.Add(opacityAnimation);

Storyboard.SetTargetProperty(opacityAnimation, "Opacity");
Storyboard.SetTarget(storyboard, myObject);

storyboard.Begin();


来源:https://stackoverflow.com/questions/8631088/windows-8-beginanimation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!