Beispiel #1
0
        private void BeginOpenStoryboard()
        {
            ViewModel.RestoreParentHitTest(false);

            CurrentLocation.Template   = (ControlTemplate)Resources["PushpinTemplate"];
            ContactLocation.Visibility = Visibility.Visible;
            for (int i = 0; i < Map.Children.Count; i++)
            {
                var pushpin = Map.Children[i] as Pushpin;
                if (pushpin != null && pushpin.Tag == "live")
                {
                    Map.Children.RemoveAt(i--);
                }
            }

            OnLoaded(null, null);

            Venues.ScrollToTop();
            SearchPlaceholder.Content = null;

            var rootFrameHeight = ((PhoneApplicationFrame)Application.Current.RootVisual).ActualHeight;
            var translateYTo    = rootFrameHeight;

            var storyboard         = new Storyboard();
            var translateAnimaiton = new DoubleAnimationUsingKeyFrames();

            translateAnimaiton.KeyFrames.Add(new EasingDoubleKeyFrame {
                KeyTime = TimeSpan.FromSeconds(0.0), Value = translateYTo
            });
            translateAnimaiton.KeyFrames.Add(new EasingDoubleKeyFrame {
                KeyTime = TimeSpan.FromSeconds(0.4), Value = 0.0, EasingFunction = new ExponentialEase {
                    Exponent = 5.0, EasingMode = EasingMode.EaseOut
                }
            });
            Storyboard.SetTarget(translateAnimaiton, LayoutRoot);
            Storyboard.SetTargetProperty(translateAnimaiton, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
            storyboard.Children.Add(translateAnimaiton);

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                LayoutRoot.Opacity    = 1.0;
                LayoutRoot.Visibility = Visibility.Visible;
                storyboard.Begin();
            });

            storyboard.Completed += (sender, args) =>
            {
                Map.Visibility = Visibility.Visible;
            };
        }