Marquee Text witl multi content

给你一囗甜甜゛ 提交于 2019-12-11 13:55:17

问题


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.


回答1:


Finally i found my answer

<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>

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);
    }

thanks.



来源:https://stackoverflow.com/questions/30458484/marquee-text-witl-multi-content

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