
Untitled
By: a guest on
Jan 4th, 2013 | syntax:
None | size: 1.71 KB | hits: 16 | expires: Never
<Canvas ClipToBounds="True" Name="canMain" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<StackPanel Name="tbmarquee" HorizontalAlignment="Stretch" ></StackPanel>
</Canvas>
private void BottomToTopMarquee()
{
tbmarquee.Orientation = Orientation.Vertical;
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = -tbmarquee.ActualHeight;
doubleAnimation.To = canMain.ActualHeight;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
tbmarquee.BeginAnimation(Canvas.BottomProperty, doubleAnimation);
}
Thread thread = new Thread(new ThreadStart(
delegate()
{
DispatcherOperation dispatcherOp =
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(
delegate()
{
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = -tbmarquee.ActualHeight;
doubleAnimation.To = canMain.ActualHeight;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
tbmarquee.BeginAnimation(Canvas.BottomProperty, doubleAnimation);
}));
dispatcherOp.Completed += new EventHandler(DispatcherOpCompleted);
}));
thread.Start();
MediaTimeline.DesiredFrameRateProperty.OverrideMetadata(typeof(System.Windows.Media.Animation.Timeline), new FrameworkPropertyMetadata(10));