Skip to content

Commit 84708e9

Browse files
Renaming properties
Co-Authored-By: Justin Liu <[email protected]>
1 parent c13bff2 commit 84708e9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

components/Shimmer/src/Shimmer/Shimmer.Properties.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace CommunityToolkit.Labs.WinUI;
66
public partial class Shimmer : Control
77
{
8-
public static readonly DependencyProperty AnimationDurationInMillisecondsProperty = DependencyProperty.Register(
9-
nameof(AnimationDurationInMilliseconds), typeof(double), typeof(Shimmer), new PropertyMetadata(1600d, (s, e) =>
8+
public static readonly DependencyProperty DurationProperty = DependencyProperty.Register(
9+
nameof(Duration), typeof(TimeSpan), typeof(Shimmer), new PropertyMetadata(TimeSpan.FromMilliseconds(1600), (s, e) =>
1010
{
1111
var self = (Shimmer)s;
1212
if (self.IsAnimating)
@@ -31,10 +31,10 @@ public partial class Shimmer : Control
3131
}
3232
}));
3333

34-
public double AnimationDurationInMilliseconds
34+
public TimeSpan Duration
3535
{
36-
get => (double)GetValue(AnimationDurationInMillisecondsProperty);
37-
set => SetValue(AnimationDurationInMillisecondsProperty, value);
36+
get => (TimeSpan)GetValue(DurationProperty);
37+
set => SetValue(DurationProperty, value);
3838
}
3939

4040
public bool IsAnimating

components/Shimmer/src/Shimmer/Shimmer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ protected override void OnApplyTemplate()
6363
base.OnApplyTemplate();
6464

6565
_shape = GetTemplateChild(PART_Shape) as Border;
66-
if (_initialized is false && TryInitializationResource() && IsAnimating)
66+
if (_initialized is false && TryInitializationResource() && IsActive)
6767
{
6868
TryStartAnimation();
6969
}
7070
}
7171

7272
private void OnLoaded(object sender, RoutedEventArgs e)
7373
{
74-
if (_initialized is false && TryInitializationResource() && IsAnimating)
74+
if (_initialized is false && TryInitializationResource() && IsActive)
7575
{
7676
TryStartAnimation();
7777
}
@@ -194,14 +194,14 @@ private void TryStartAnimation()
194194
_rectangleGeometry.StartAnimation(nameof(CompositionRoundedRectangleGeometry.Size), _sizeAnimation);
195195

196196
_gradientStartPointAnimation = rootVisual.Compositor.CreateVector2KeyFrameAnimation();
197-
_gradientStartPointAnimation.Duration = TimeSpan.FromMilliseconds(AnimationDurationInMilliseconds);
197+
_gradientStartPointAnimation.Duration = Duration;
198198
_gradientStartPointAnimation.IterationBehavior = AnimationIterationBehavior.Forever;
199199
_gradientStartPointAnimation.InsertKeyFrame(0.0f, new Vector2(InitialStartPointX, 0.0f));
200200
_gradientStartPointAnimation.InsertKeyFrame(1.0f, Vector2.Zero);
201201
_shimmerMaskGradient.StartAnimation(nameof(CompositionLinearGradientBrush.StartPoint), _gradientStartPointAnimation);
202202

203203
_gradientEndPointAnimation = rootVisual.Compositor.CreateVector2KeyFrameAnimation();
204-
_gradientEndPointAnimation.Duration = TimeSpan.FromMilliseconds(AnimationDurationInMilliseconds);
204+
_gradientEndPointAnimation.Duration = Duration;
205205
_gradientEndPointAnimation.IterationBehavior = AnimationIterationBehavior.Forever;
206206
_gradientEndPointAnimation.InsertKeyFrame(0.0f, new Vector2(1.0f, 0.0f)); //Vector2.One
207207
_gradientEndPointAnimation.InsertKeyFrame(1.0f, new Vector2(-InitialStartPointX, 1.0f));

0 commit comments

Comments
 (0)