@@ -92,6 +92,7 @@ public FrameworkElement AutoHideElement
9292 set
9393 {
9494 _autoHideElement = value ;
95+ _autoHideElement . RenderTransform = new TranslateTransform ( ) ;
9596 OnPropertyChanged ( ) ;
9697 }
9798 }
@@ -225,24 +226,18 @@ private void AnimateAutoHide(bool isHiding, bool immediate = false)
225226 animation . BeginTime = TimeSpan . FromMilliseconds ( immediate ? 0 : isHiding ? AutoHideDelayMs : AutoHideShowDelayMs ) ;
226227 animation . EasingFunction = new SineEase ( ) ;
227228
228- Storyboard . SetTarget ( animation , AutoHideElement ) ;
229- Storyboard . SetTargetProperty ( animation , new PropertyPath ( $ "RenderTransform.(TranslateTransform.{ ( Orientation == Orientation . Horizontal ? 'Y' : 'X' ) } )") ) ;
230-
231- var storyboard = new Storyboard ( ) ;
232- storyboard . Children . Add ( animation ) ;
233-
234229 animation . CurrentStateInvalidated += ( object sender , EventArgs e ) => {
235230 if ( ( ( AnimationClock ) sender ) . CurrentState == ClockState . Active )
236231 {
237232 OnAutoHideAnimationBegin ( isHiding ) ;
238233 }
239234 } ;
240235
241- storyboard . Completed += ( object sender , EventArgs e ) => {
236+ animation . Completed += ( object sender , EventArgs e ) => {
242237 OnAutoHideAnimationComplete ( isHiding ) ;
243238 } ;
244239
245- storyboard . Begin ( AutoHideElement ) ;
240+ AutoHideElement . RenderTransform . BeginAnimation ( Orientation == Orientation . Horizontal ? TranslateTransform . YProperty : TranslateTransform . XProperty , animation ) ;
246241 }
247242
248243 protected void PeekDuringAutoHide ( int msToPeek = 1000 )
@@ -368,6 +363,8 @@ private void OnClosing(object sender, CancelEventArgs e)
368363 {
369364 UnregisterAppBar ( ) ;
370365 _appBarManager . UnregisterAutoHideBar ( this ) ;
366+ AutoHideElement ? . RenderTransform ? . BeginAnimation ( TranslateTransform . YProperty , null ) ;
367+ AutoHideElement ? . RenderTransform ? . BeginAnimation ( TranslateTransform . XProperty , null ) ;
371368
372369 // unregister full-screen notifications
373370 _fullScreenHelper . FullScreenApps . CollectionChanged -= FullScreenApps_CollectionChanged ;
0 commit comments