private void BottomToTopMarquee() { double width = CanvasMain.ActualWidth - TextBlockMain.ActualWidth; TextBlockMain.Margin = new Thickness(width / 2, 0, 0, 0); var doubleAnimation = new DoubleAnimation { From = -TextBlockMain.ActualHeight, To = CanvasMain.ActualHeight, RepeatBehavior = RepeatBehavior.Forever, Duration = new Duration(TimeSpan.FromSeconds(ScrollDurationInSeconds)) }; TextBlockMain.BeginAnimation(Canvas.BottomProperty, doubleAnimation); }
private void RightToLeftMarquee() { double height = CanvasMain.ActualHeight - TextBlockMain.ActualHeight; TextBlockMain.Margin = new Thickness(0, height / 2, 0, 0); var doubleAnimation = new DoubleAnimation { From = -TextBlockMain.ActualWidth, To = CanvasMain.ActualWidth, RepeatBehavior = RepeatBehavior.Forever, Duration = new Duration(TimeSpan.FromSeconds(ScrollDurationInSeconds)) }; TextBlockMain.BeginAnimation(Canvas.RightProperty, doubleAnimation); }