字幕文本多内容 [英] Marquee Text witl multi content
本文介绍了字幕文本多内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此帖子上的文本字幕
字幕文本
I am trying to use a text marquee like on this post Marquee Text
但是我不知道在动画循环后如何更改文本块内容。
感谢您的帮助。
But i dont know how can i change the textblock content after a cycle of animation. thanks for your help.
我真的很坚持。请帮助我。
I really stuck. please help me.
推荐答案
最后我找到了答案
<TextBlock x:Name="_box" FontSize="64" Text="My Simple Text.">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="AnimatedTranslateTransform" X="0" Y="0" />
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="TextBlock.Loaded">
<BeginStoryboard>
<Storyboard Name="MyStorybord">
<DoubleAnimation
Storyboard.TargetName="AnimatedTranslateTransform"
Storyboard.TargetProperty="X"
From="-300" To="300" Duration="0:0:5"
Completed="Timeline_OnCompleted" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
这会导致文本框移动一次。在方法 Timeline_OnCompleted中,我更改文本并再次启动动画。
this cause the text box move one time. in method "Timeline_OnCompleted" I Change the Text And start the animation again.
private void Timeline_OnCompleted(object sender, EventArgs e)
{
_box.Text = MytextArray[index];
BeginStoryboard(MyStorybord);
}
谢谢。
这篇关于字幕文本多内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文