动画保证金变化在Silverlight [英] Animate Margin Change in Silverlight

查看:101
本文介绍了动画保证金变化在Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我动画的边界在Silverlight但是调整我还需要逐步消除周围的保证金(目前为50)。混合似乎并没有产生变化的保证金吐温 - 它只是从50跳到0一气呵成。有没有办法实现这一目标?

I am animating a border resize in Silverlight however I also need to gradually remove the margin around it (currently 50). Blend doesn't seem to generate a tween for margin change - it just jumps from 50 to 0 in one go. Is there a way to achieve this?

推荐答案

的问题是,一个保证金是真的类型System.Windows.Thickness,这是不是一个依赖对象,从而左,上,右,和底部都没有依赖属性,因此不能使用DoubleAnimation是(它允许渐变)动画。

The problem is that a Margin is really of type "System.Windows.Thickness" which is NOT a dependency object, thus Left, Top, Right, and Bottom are NOT Dependency Properties and thus cannot be animated using DoubleAnimation (which allows for tweening).

什么是用来制作动画的保证金是不吐温的ObjectAnimation。这就是为什么你看到它的原始位置保证金跳转到新的位置。再举一个常见的​​例子,当您尝试动画可见光和折叠的Visibility属性同样的情况。

What is used to animate the Margin is an ObjectAnimation which does not tween. This is why you see the margin jump from its original location to its new location. As another common example, the same happens when you try to animate the Visibility property between Visible and Collapsed.

您要么需要做的基于定时器的动画以动画保证金或实现自己的动画类型厚度的对象。

You would either need to do timer based animation in order to animate margin or implement your own Animation type for Thickness objects.

这篇关于动画保证金变化在Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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