private void BeginOpenStoryboard() { SystemTray.IsVisible = false; ApplicationBar.IsVisible = true; PanAndZoom.CurrentScaleX = 1.0; PanAndZoom.CurrentScaleY = 1.0; var transparentBlack = Colors.Black; transparentBlack.A = 0; Visibility = Visibility.Visible; ImagesGrid.Opacity = 1.0; ImagesGrid.RenderTransform = new CompositeTransform(); BackgroundBorder.Opacity = 1.0; var duration = TimeSpan.FromSeconds(0.25); var easingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 5.0 }; var storyboard = new Storyboard(); var rootFrameHeight = ((PhoneApplicationFrame)Application.Current.RootVisual).ActualHeight; var translateYTo = rootFrameHeight; ((CompositeTransform)ImagesGrid.RenderTransform).TranslateY = translateYTo; var translateImageAniamtion = new DoubleAnimationUsingKeyFrames(); translateImageAniamtion.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = translateYTo }); translateImageAniamtion.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = duration, Value = 0.0, EasingFunction = easingFunction }); Storyboard.SetTarget(translateImageAniamtion, ImagesGrid); Storyboard.SetTargetProperty(translateImageAniamtion, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); storyboard.Children.Add(translateImageAniamtion); storyboard.Completed += (sender, args) => { Deployment.Current.Dispatcher.BeginInvoke(() => OpenApplicationPanelAnimation.Begin()); }; Deployment.Current.Dispatcher.BeginInvoke(storyboard.Begin); }
private void BeginOpenStoryboard() { var selector = (DecryptedImageViewerTemplateSelector)Resources["Selector"]; Control1.Visibility = Visibility.Collapsed; Control1.Content = ViewModel.PreviousItem; Control1.ContentTemplate = (DataTemplate)selector.Convert(ViewModel.PreviousItem, null, null, null); Grid.SetColumn(Item1, 0); Control2.Visibility = Visibility.Visible; Control2.Content = ViewModel.CurrentItem; Control2.ContentTemplate = (DataTemplate)selector.Convert(ViewModel.CurrentItem, null, null, null); Grid.SetColumn(Item2, 1); Control3.Visibility = Visibility.Collapsed; Control3.Content = ViewModel.NextItem; Control3.ContentTemplate = (DataTemplate)selector.Convert(ViewModel.NextItem, null, null, null); Grid.SetColumn(Item3, 2); SetPanAndZoom(); SystemTray.IsVisible = false; ApplicationBar.IsVisible = true; if (_panAndZoomBehavior != null) { _panAndZoomBehavior.CurrentScaleX = 1.0; _panAndZoomBehavior.CurrentScaleY = 1.0; } var transparentBlack = Colors.Black; transparentBlack.A = 0; Visibility = Visibility.Visible; ImagesGrid.Opacity = 1.0; ImagesGrid.RenderTransform = new CompositeTransform(); BackgroundBorder.Opacity = 1.0; var duration = TimeSpan.FromSeconds(0.25); var easingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 5.0 }; var storyboard = new Storyboard(); var rootFrameHeight = ((PhoneApplicationFrame)Application.Current.RootVisual).ActualHeight; var translateYTo = rootFrameHeight; ((CompositeTransform)ImagesGrid.RenderTransform).TranslateY = translateYTo; var translateImageAniamtion = new DoubleAnimationUsingKeyFrames(); translateImageAniamtion.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = translateYTo }); translateImageAniamtion.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = duration, Value = 0.0, EasingFunction = easingFunction }); Storyboard.SetTarget(translateImageAniamtion, ImagesGrid); Storyboard.SetTargetProperty(translateImageAniamtion, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); storyboard.Children.Add(translateImageAniamtion); storyboard.Completed += (sender, args) => { Control1.Visibility = Visibility.Visible; Control2.Visibility = Visibility.Visible; Control3.Visibility = Visibility.Visible; Deployment.Current.Dispatcher.BeginInvoke(() => { OpenApplicationPanelAnimation.Begin(); OpenTopApplicationPanelAnimation.Begin(); }); }; Deployment.Current.Dispatcher.BeginInvoke(storyboard.Begin); }