44
55#nullable enable
66
7+ using System ;
78using Windows . UI . Composition ;
89using Windows . UI . Xaml ;
910using static Microsoft . Toolkit . Uwp . UI . Animations . AnimationExtensions ;
@@ -14,9 +15,35 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
1415 /// A base model representing a typed animation that can be used as an implicit composition animation.
1516 /// </summary>
1617 /// <inheritdoc cref="Animation{TValue, TKeyFrame}"/>
17- public abstract class ImplicitAnimation < TValue , TKeyFrame > : Animation < TValue , TKeyFrame > , IImplicitTimeline
18+ public abstract class ImplicitAnimation < TValue , TKeyFrame > : Animation < TValue , TKeyFrame > , IImplicitTimeline , IInternalImplicitAnimation
1819 where TKeyFrame : unmanaged
1920 {
21+ /// <inheritdoc cref="IInternalImplicitAnimation.AnimationPropertyChanged"/>
22+ private event EventHandler ? AnimationPropertyChanged ;
23+
24+ /// <summary>
25+ /// Initializes a new instance of the <see cref="ImplicitAnimation{TValue, TKeyFrame}"/> class.
26+ /// </summary>
27+ protected ImplicitAnimation ( )
28+ {
29+ RegisterPropertyChangedCallback ( DelayProperty , RaiseAnimationPropertyChanged ) ;
30+ RegisterPropertyChangedCallback ( DurationProperty , RaiseAnimationPropertyChanged ) ;
31+ RegisterPropertyChangedCallback ( EasingTypeProperty , RaiseAnimationPropertyChanged ) ;
32+ RegisterPropertyChangedCallback ( EasingModeProperty , RaiseAnimationPropertyChanged ) ;
33+ RegisterPropertyChangedCallback ( RepeatProperty , RaiseAnimationPropertyChanged ) ;
34+ RegisterPropertyChangedCallback ( DelayBehaviorProperty , RaiseAnimationPropertyChanged ) ;
35+ RegisterPropertyChangedCallback ( ToProperty , RaiseAnimationPropertyChanged ) ;
36+ RegisterPropertyChangedCallback ( FromProperty , RaiseAnimationPropertyChanged ) ;
37+ RegisterPropertyChangedCallback ( KeyFramesProperty , RaiseAnimationPropertyChanged ) ;
38+ }
39+
40+ /// <inheritdoc/>
41+ event EventHandler ? IInternalImplicitAnimation . AnimationPropertyChanged
42+ {
43+ add => AnimationPropertyChanged += value ;
44+ remove => AnimationPropertyChanged -= value ;
45+ }
46+
2047 /// <summary>
2148 /// Gets or sets the optional implicit target for the animation. This can act as a trigger property for the animation.
2249 /// </summary>
@@ -67,5 +94,15 @@ public CompositionAnimation GetAnimation(UIElement element, out string? target)
6794
6895 return builder . GetAnimation ( element . GetVisual ( ) , out _ ) ;
6996 }
97+
98+ /// <summary>
99+ /// Raises <see cref="AnimationPropertyChanged"/> event.
100+ /// </summary>
101+ /// <param name="sender">The instance raising the event.</param>
102+ /// <param name="property">The <see cref="DependencyProperty"/> that was changed.</param>
103+ private void RaiseAnimationPropertyChanged ( DependencyObject sender , DependencyProperty property )
104+ {
105+ AnimationPropertyChanged ? . Invoke ( this , EventArgs . Empty ) ;
106+ }
70107 }
71108}
0 commit comments