我有一个C#WPF应用程序需要24小时运行,它包含很多动画。 我发现如果我使用动画的已完成事件,则父对象无法破坏,然后应用程序在不到一个小时内变得迟钝。这是wpf或其他什么的错误? 以前有人经历过? (新手到wpf)
private void AnimUpperBGFade(Canvas canvas, int delay = 0)
{
DoubleAnimation animY = new DoubleAnimation();
ScaleTransform S = new ScaleTransform();
animY.BeginTime = TimeSpan.FromMilliseconds(delay);
animY.Duration = new Duration(TimeSpan.FromMilliseconds(RECT_FADE_MS));
animY.From = 1.0;
animY.To = 0.0;
// If I add the completed event, the class object will not destruct
/*
animY.Completed += (sender, e)
{
// some callback function here
};
*/
canvas.RenderTransform = S;
S.BeginAnimation(ScaleTransform.ScaleYProperty, animY);
}