Skip to content

Commit 4612a38

Browse files
committed
Added sample page demo for reset feature
1 parent f84a747 commit 4612a38

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsPage.xaml.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Numerics;
77
using Microsoft.Toolkit.Uwp.UI;
8+
using Microsoft.Toolkit.Uwp.UI.Animations;
89
using Windows.UI.Xaml;
910
using Windows.UI.Xaml.Controls;
1011
using Windows.UI.Xaml.Hosting;
@@ -18,6 +19,8 @@ public sealed partial class ImplicitAnimationsPage : IXamlRenderListener
1819
{
1920
private Random _random = new Random();
2021
private UIElement _element;
22+
private ImplicitAnimationSet _animationSet;
23+
private bool _areAnimationsToggled;
2124

2225
public ImplicitAnimationsPage()
2326
{
@@ -28,6 +31,8 @@ public ImplicitAnimationsPage()
2831
public void OnXamlRendered(FrameworkElement control)
2932
{
3033
_element = control.FindChild("Element");
34+
_animationSet = Implicit.GetAnimations(_element);
35+
_areAnimationsToggled = true;
3136
}
3237

3338
private void Load()
@@ -60,6 +65,16 @@ private void Load()
6065
1);
6166
}
6267
});
68+
69+
SampleController.Current.RegisterNewCommand("Toggle animations", (sender, args) =>
70+
{
71+
if (_element != null)
72+
{
73+
Implicit.SetAnimations(_element, _areAnimationsToggled ? null : _animationSet);
74+
75+
_areAnimationsToggled = !_areAnimationsToggled;
76+
}
77+
});
6378
}
6479
}
6580
}

0 commit comments

Comments
 (0)