答案 0 :(得分:0)
最后我找到了答案
<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”中我更改文本并再次开始动画。
private void Timeline_OnCompleted(object sender, EventArgs e)
{
_box.Text = MytextArray[index];
BeginStoryboard(MyStorybord);
}
感谢。