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 55using System ;
66using System . Numerics ;
77using Microsoft . Toolkit . Uwp . UI ;
8+ using Microsoft . Toolkit . Uwp . UI . Animations ;
89using Windows . UI . Xaml ;
910using Windows . UI . Xaml . Controls ;
1011using 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}
You can’t perform that action at this time.
0 commit comments