Windows 8中 - BeginAnimation? [英] Windows 8 - BeginAnimation?

查看:112
本文介绍了Windows 8中 - BeginAnimation?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来我不能做 myObject.BeginAnimation(DP,动画)

这是一个错误或者有没有改变?

Is this a bug or has it been changed?

推荐答案

您需要使用一个故事板。 。您的动画添加到故事板,并有故事板开始动画

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();

这篇关于Windows 8中 - BeginAnimation?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆