gpt4 book ai didi

wpf - 为什么我不能在动画后修改对象?

转载 作者:行者123 更新时间:2023-12-04 07:07:05 24 4
gpt4 key购买 nike

执行这段代码后...

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

这是怎么回事??谢谢!

最佳答案

来自 Dependency Properties Overview :

Dependency properties can be animated. When an animation is applied and is running, the animated value operates at a higher precedence than any value (such as a local value) that the property otherwise has.



您需要将动画的 FillBehavior 设置为 Stop 以使本地值优先。

关于wpf - 为什么我不能在动画后修改对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/972600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com