File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 5
5
using System ;
6
6
using System . Numerics ;
7
7
using Microsoft . Toolkit . Uwp . UI ;
8
+ using Microsoft . Toolkit . Uwp . UI . Animations ;
8
9
using Windows . UI . Xaml ;
9
10
using Windows . UI . Xaml . Controls ;
10
11
using Windows . UI . Xaml . Hosting ;
@@ -18,6 +19,8 @@ public sealed partial class ImplicitAnimationsPage : IXamlRenderListener
18
19
{
19
20
private Random _random = new Random ( ) ;
20
21
private UIElement _element ;
22
+ private ImplicitAnimationSet _animationSet ;
23
+ private bool _areAnimationsToggled ;
21
24
22
25
public ImplicitAnimationsPage ( )
23
26
{
@@ -28,6 +31,8 @@ public ImplicitAnimationsPage()
28
31
public void OnXamlRendered ( FrameworkElement control )
29
32
{
30
33
_element = control . FindChild ( "Element" ) ;
34
+ _animationSet = Implicit . GetAnimations ( _element ) ;
35
+ _areAnimationsToggled = true ;
31
36
}
32
37
33
38
private void Load ( )
@@ -60,6 +65,16 @@ private void Load()
60
65
1 ) ;
61
66
}
62
67
} ) ;
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
+ } ) ;
63
78
}
64
79
}
65
80
}
You can’t perform that action at this time.
0 commit comments