I have the following code:
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
Throws:
Specified value of type 'System.Windows.Media.Animation.DoubleAnimationUsingPath' must have IsFrozen set to false to modify.
How can I remove the event handler if the object is frozen? My concern is that if the event handler is not removed the animation object will not be properly garbage collected.