Added sample page demo for reset feature
This commit is contained in:
Родитель
f84a747464
Коммит
4612a38f2a
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче