我尝试使用 和 实现具有不同高度的一组不同控件的Canvas
动画Stackpanel
。
所以我填充Stackpanel
并应用了所有设置,但无论如何,在开始的动画中跳跃了一段时间,只有在这一切顺利之后,当它结束时,它又会跳跃 2-3 次等等......
任何线索为什么?我使用经典的双重动画等......
谢谢你的任何线索!
<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();
我的意思是动画开始并不顺利,它正在跳跃……但后来进展顺利……