Skip to content

Commit

Permalink
Added sample page demo for reset feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Sep 24, 2021
1 parent f84a747 commit 4612a38
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,6 +19,8 @@ public sealed partial class ImplicitAnimationsPage : IXamlRenderListener
{
private Random _random = new Random();
private UIElement _element;
private ImplicitAnimationSet _animationSet;
private bool _areAnimationsToggled;

public ImplicitAnimationsPage()
{
Expand All @@ -28,6 +31,8 @@ public ImplicitAnimationsPage()
public void OnXamlRendered(FrameworkElement control)
{
_element = control.FindChild("Element");
_animationSet = Implicit.GetAnimations(_element);
_areAnimationsToggled = true;
}

private void Load()
Expand Down Expand Up @@ -60,6 +65,16 @@ private void Load()
1);
}
});

SampleController.Current.RegisterNewCommand("Toggle animations", (sender, args) =>
{
if (_element != null)
{
Implicit.SetAnimations(_element, _areAnimationsToggled ? null : _animationSet);

_areAnimationsToggled = !_areAnimationsToggled;
}
});
}
}
}

0 comments on commit 4612a38

Please sign in to comment.