예제 #1
0
    private static void _OnAttachStoryboardChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        FrameworkElement target           = (FrameworkElement)d;
        AttachStoryboard attachStoryboard = (AttachStoryboard)e.NewValue;

        if (attachStoryboard != null)
        {
            BeginStoryboard beginStoryboard = new BeginStoryboard {
                Storyboard = attachStoryboard.Storyboard
            };
            EventTrigger trigger = new EventTrigger(attachStoryboard.Trigger);
            trigger.Actions.Add(beginStoryboard);
            attachStoryboard.Storyboard.Completed += (sender, e1) => attachStoryboard.RaiseCompleted();
            target.Triggers.Add(trigger);
        }
    }
예제 #2
0
 public static void SetAttachStoryboard(FrameworkElement target, AttachStoryboard value)
 {
     target.SetValue(AttachStoryboardProperty, value);
 }