From 4612a38f2a7dadfbe70eb2b9629b69c74381c151 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 24 Sep 2021 17:55:26 +0200 Subject: [PATCH] Added sample page demo for reset feature --- .../ImplicitAnimationsPage.xaml.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsPage.xaml.cs index 4ca01d013..f038f8bee 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsPage.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Numerics; using Microsoft.Toolkit.Uwp.UI; +using Microsoft.Toolkit.Uwp.UI.Animations; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Hosting; @@ -18,6 +19,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages { private Random _random = new Random(); private UIElement _element; + private ImplicitAnimationSet _animationSet; + private bool _areAnimationsToggled; public ImplicitAnimationsPage() { @@ -28,6 +31,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages public void OnXamlRendered(FrameworkElement control) { _element = control.FindChild("Element"); + _animationSet = Implicit.GetAnimations(_element); + _areAnimationsToggled = true; } private void Load() @@ -60,6 +65,16 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages 1); } }); + + SampleController.Current.RegisterNewCommand("Toggle animations", (sender, args) => + { + if (_element != null) + { + Implicit.SetAnimations(_element, _areAnimationsToggled ? null : _animationSet); + + _areAnimationsToggled = !_areAnimationsToggled; + } + }); } } } \ No newline at end of file