Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 1.71 KB  |  views: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <Canvas  ClipToBounds="True" Name="canMain" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
  2.    <StackPanel  Name="tbmarquee" HorizontalAlignment="Stretch"  ></StackPanel>
  3. </Canvas>
  4.  
  5. private void BottomToTopMarquee()
  6. {
  7.      tbmarquee.Orientation = Orientation.Vertical;  
  8.      DoubleAnimation doubleAnimation = new DoubleAnimation();
  9.      doubleAnimation.From = -tbmarquee.ActualHeight;
  10.      doubleAnimation.To = canMain.ActualHeight;
  11.      doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
  12.      doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
  13.      tbmarquee.BeginAnimation(Canvas.BottomProperty, doubleAnimation);
  14.  }
  15.        
  16. Thread thread = new Thread(new ThreadStart(
  17.             delegate()
  18.             {
  19.                 DispatcherOperation dispatcherOp =
  20.                   this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(
  21.                     delegate()
  22.                     {
  23.  
  24.                         DoubleAnimation doubleAnimation = new DoubleAnimation();
  25.                         doubleAnimation.From = -tbmarquee.ActualHeight;
  26.                         doubleAnimation.To = canMain.ActualHeight;
  27.                         doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
  28.                         doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
  29.                         tbmarquee.BeginAnimation(Canvas.BottomProperty, doubleAnimation);
  30.                     }));
  31.                 dispatcherOp.Completed += new EventHandler(DispatcherOpCompleted);
  32.             }));
  33.             thread.Start();
  34.        
  35. MediaTimeline.DesiredFrameRateProperty.OverrideMetadata(typeof(System.Windows.Media.Animation.Timeline), new FrameworkPropertyMetadata(10));