/// <summary>
        /// Main Window Loading
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// An <see cref="T:System.Windows.RoutedEventArgs"> RoutedEventArgs </see> that contains the
        /// event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var doubleAnimation = new DoubleAnimation
            {
                From           = -tbmarquee.ActualWidth,
                To             = canMain.ActualWidth,
                RepeatBehavior = RepeatBehavior.Forever,
                Duration       = new Duration(TimeSpan.Parse("0:0:10"))
            };

            tbmarquee.BeginAnimation(Canvas.LeftProperty, doubleAnimation);
            doubleAnimation.BeginAnimation(Canvas.LeftProperty, doubleAnimation);
        }
Exemple #2
0
        void ValueSnapHandler_SnappedEventHandler(object sender, ValueSnapHandler.SnapEventArgs e)
        {
            XValueSnapMarker.Visibility = Visibility.Visible;

            var _snapMarkerAnimation = new DoubleAnimation()
            {
                From = 0.8, To = 0, Duration = TimeSpan.FromSeconds(0.4)
            };

            _snapMarkerAnimation.BeginAnimation(UIElement.OpacityProperty, _snapMarkerAnimation);

            XValueSnapMarker.RenderTransform = new TranslateTransform(0, vToY(e.Value));
            XValueSnapMarker.Opacity         = 1;

            XValueSnapMarker.BeginAnimation(UIElement.OpacityProperty, _snapMarkerAnimation);
        }
        private static void BeginAnimation(SearchTextBox searchTextBox, double toWidth)
        {
            var widthAnimation = new DoubleAnimation(toWidth, new TimeSpan(0, 0, 0, 0, 200))
            {
                EasingFunction = new SineEase()
                {
                    EasingMode = EasingMode.EaseInOut
                }
            };

            widthAnimation.Completed += (sender, args) =>
            {
                widthAnimation.BeginAnimation(WidthProperty, null);
                searchTextBox._isAnimated = false;
            };

            searchTextBox._isAnimated = true;
            searchTextBox.BeginAnimation(WidthProperty, widthAnimation);
        }