WPF Credits effect problem: StoryBoard to animate a StackPanel that extends the height of the window

ⅰ亾dé卋堺 提交于 2019-12-04 23:21:38

I see two things that you could try out:

  1. Use a ScrollViewer with disabled scrollbars around the StackPanel. Sadly, you cannot animate the scroll offset directly, so you would need to create something like a timer in code behind and call ScrollToVerticalOffset() periodically.

  2. Try putting the StackPanel on a Canvas and animate Canvas.Top (set on the StackPanel) instead of the RenderTransforms.

I will supply a code sample if you need one.

Andrej

I agree with Andrej, just make a new List Box type that has the scrollbars disabled.

You can animate the scroll offset, I've got it happening in a Custom Control I'm writing right now. This is in a function in the class for the List Box:


Duration animationDuration = new Duration(new TimeSpan(0, 0, 0, 0, _scrollSpeed));
DoubleAnimation animateHscroll = new DoubleAnimation(thisScrollViewer.HorizontalOffset, TargetHorizontalOffset, animationDuration);

thisScrollViewer.BeginAnimation(HorizontalScrollOffsetProperty, animateHscroll);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!