private static void OnStoryboardChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) { var oldListener = (StoryboardListener)target.GetValue(StoryboardCompleteBehavior.StoryboardListenerProperty); if (oldListener != null) { oldListener.DeleteHandler(); } Storyboard storyboard = (Storyboard)e.NewValue; storyboard.Stop(); var listener = new StoryboardListener(target, storyboard); target.SetValue(StoryboardCompleteBehavior.StoryboardListenerProperty, listener); }
private static void OnStoryboardChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) { var oldListener = (StoryboardListener)target.GetValue(StoryboardCompleteBehavior.StoryboardListenerProperty); if (oldListener != null) { oldListener.DeleteHandler(); } Storyboard storyboard = (Storyboard)e.NewValue; var listener = new StoryboardListener(target, storyboard); target.SetValue(StoryboardCompleteBehavior.StoryboardListenerProperty, listener); }