WPF - 从冻结的动画对象中删除事件处理程序

时间:2016-04-13 10:05:05

标签: .net wpf vb.net

我有以下代码:

AddHandler aX.Completed, AddressOf AnimationCompleted

...

Private Sub AnimationCompleted(sender As Object, e As EventArgs)

      Dim ac As AnimationClock = sender
      Dim aX As DoubleAnimationUsingPath = ac.Timeline

      RemoveHandler aX.Completed, AddressOf AnimationCompleted

End Sub

抛出:

  

类型' System.Windows.Media.Animation.DoubleAnimationUsingPath'的指定值必须将IsFrozen设置为false才能修改。

如果对象被冻结,如何删除事件处理程序?我担心的是,如果没有删除事件处理程序,动画对象将无法正确地进行垃圾回收。

0 个答案:

没有答案