在我看来,AnimationTimeline是用来设定一个类的值范围
比如DoubleAnimation 可以设置double的范围,实现动画,但是如果wpf本身没有定义的Animation就要我们自己写了
比如 GridLength 秒速grid放个的大小,但是没有GridLengthAnimation
前天在实现那个led显示屏软件的时候就用到了这个东西。
在网上查了一些资料,有代码有真相,下面是代码:
internal class GridLengthAnimation : AnimationTimeline
{
static GridLengthAnimation()
{
FromProperty = DependencyProperty.Register("From", typeof(GridLength),
typeof(GridLengthAnimation));
ToProperty = DependencyProperty.Register("To", typeof(GridLength),
typeof(GridLengthAnimation));
}
public override Type TargetPropertyType
{
get
{
return typeof(GridLength);