Silerlight中利用TextBlock滚动显示
<Canvas x:Name="EventMovePanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Margin="5,2"> |
这里是滚动文字的代码,主要的就是StoryBoard里的属性设置: Storyboard.TargetProperty="(Canvas.Top)" From="100" To="0" Duration="0:0:20" 同理,其他方向如下设置即可: Storyboard.TargetProperty="(Canvas.Top)" From="0" To="100" Duration="0:0:20" //从上往下滚动 Storyboard.TargetProperty="(Canvas.Left)" From="0" To="100" Duration="0:0:20" //从左往右滚动 Storyboard.TargetProperty="(Canvas.Left)" From="100" To="0" Duration="0:0:20" //从右往左滚动 |
滚动内容有所变化时需要改变动画的From 与To
void changeSizeOfQualtiyPanel() Canvas.SetTop(txtGymQuality, from); |