ColorAnimation ani = new ColorAnimation(Colors.White, TimeSpan.FromSeconds(1))
{ RepeatBehavior = RepeatBehavior.Forever, AutoReverse = true };
SolidColorBrush brush1 = new SolidColorBrush(Colors.Black);
brush1.BeginAnimation(SolidColorBrush.ColorProperty, ani);
SolidColorBrush brush2 = brush1.Clone();
// brush2 is not an animated Brush
if (!brush2.HasAnimatedProperties)
MessageBox.Show("I don't want this!");
正如 MSDN Library 所说(Brush.Clone 方法):
Creates a modifiable clone of this Brush, making deep copies of this object's values. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.
那么,克隆动画画笔的最佳方法是什么? 谢谢。
最佳答案
您需要在克隆上重新创建动画。没有其他办法。
关于.net - 如何克隆动画画笔?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10566487/