执行此代码后......
DoubleAnimation a = new DoubleAnimation(newWidth, new Duration(...));
ThicknessAnimation b = new ThicknessAnimation(new Thickness(...), new Duration(...));
border.BeginAnimation(Border.MarginProperty, b);
border.BeginAnimation(Border.WidthProperty, a);
...此代码不再有效(保证金在分配新值后不会更改):
// doesn't have any effect
border.Margin = new Thickness(...);
发生了什么事?谢谢!
答案 0 :(得分:3)
来自Dependency Properties Overview:
可以为依赖项属性设置动画。 应用动画时是 运行时,动画值运行 优先级高于任何值 (如本地值)即 财产否则有。
您需要将动画的FillBehavior设置为Stop,以使本地值优先。