private void DismissComposerView() { composer.Projection = new PlaneProjection { CenterOfRotationX = 0, RotationX = 0 }; Storyboard animation = new Storyboard(); Duration duration = new Duration(TimeSpan.FromSeconds(0.3)); animation.Duration = duration; var alphaAnimation = new DoubleAnimation(); alphaAnimation.Duration = duration; animation.Children.Add(alphaAnimation); alphaAnimation.To = 0; Storyboard.SetTarget(alphaAnimation, composer); Storyboard.SetTargetProperty(alphaAnimation, new PropertyPath("Opacity")); var yAnimation = new DoubleAnimation(); yAnimation.Duration = duration; yAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; animation.Children.Add(yAnimation); yAnimation.To = -composer.Height; Storyboard.SetTarget(yAnimation, composer); Storyboard.SetTargetProperty(yAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); var planeAnimation = new DoubleAnimation(); planeAnimation.Duration = duration; planeAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; animation.Children.Add(planeAnimation); planeAnimation.To = -90; Storyboard.SetTarget(planeAnimation, composer.Projection); Storyboard.SetTargetProperty(planeAnimation, new PropertyPath("RotationX")); animation.Completed += (sender, e) => { composerPopup.IsOpen = false; composerPopup = null; composer = null; LayoutRoot.Opacity = 1; LayoutRoot.IsHitTestVisible = true; ApplicationBar = AppBarBeforeComposerPopup; ApplicationBar.IsVisible = true; }; animation.Begin(); }
private void ShowComposerView() { LayoutRoot.IsHitTestVisible = false; AppBarBeforeComposerPopup = (ApplicationBar)this.ApplicationBar; composer = new TopicReplyComposerView(); composer.Width = LayoutRoot.ActualWidth; var ct = (CompositeTransform)composer.RenderTransform; ct.TranslateY = -composer.Height; composerPopup = new Popup(); composerPopup.Child = composer; composerPopup.IsOpen = true; composer.Projection = new PlaneProjection { CenterOfRotationX = 0, RotationX = -90 }; Storyboard animation = new Storyboard(); Duration duration = new Duration(TimeSpan.FromSeconds(0.3)); animation.Duration = duration; // Content view DoubleAnimation contentAnimation = new DoubleAnimation(); animation.Children.Add(contentAnimation); contentAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.2)); contentAnimation.To = 0.2; contentAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }; Storyboard.SetTarget(contentAnimation, LayoutRoot); Storyboard.SetTargetProperty(contentAnimation, new PropertyPath("Opacity")); DoubleAnimation yAnimation = new DoubleAnimation(); animation.Children.Add(yAnimation); yAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.2)); yAnimation.To = 0; yAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; Storyboard.SetTarget(yAnimation, composer); Storyboard.SetTargetProperty(yAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); var planeAnimation = new DoubleAnimation(); planeAnimation.Duration = duration; planeAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; animation.Children.Add(planeAnimation); planeAnimation.To = 0; Storyboard.SetTarget(planeAnimation, composer.Projection); Storyboard.SetTargetProperty(planeAnimation, new PropertyPath("RotationX")); animation.Completed += (sender, e) => { Dispatcher.BeginInvoke(() => { ApplicationBar = Resources["ComposerAppBar"] as ApplicationBar; // Auto focus on subject field composer.MessageTextBox.Focus(); }); }; animation.Begin(); }