0

I've got a TextBlock that when the text is shown, it has an animation displaying the text.

I'm trying to display more than one string (dynamically) like, "Hello Foo" and then "Bye Foo" and it should work like this:

First appears "Hello Foo" and after the animation ends, "Bye Foo" starts displaying.

But it just goes directly to the last storyboard animation "Bye Foo".

I've tried with awaiting storyboard completion but didnt work.

I've searched this topic a lot but nothing seems to solve it.

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    TextBlockAnimation("Hello Foo");
    TextBlockAnimation("Bye Foo");
}

public void TextBlockAnimation(string text)
{
    //storyboard etc...
    storyboard.Begin();
}

How can i accomplish it ? Thanks!

  • Start the second animation in the Completed event handler of the first one, or just set the second animation's BeginTime to the Duration of the first one. – Clemens Sep 27 '21 at 07:25
  • @Clemens but what if i have a N TextBlockAnimations ? how can it be dynamic? – Eduardo Silva Sep 27 '21 at 07:31
  • The solution would be the same. Either use the Completed event or set BeginTimes. – Clemens Sep 27 '21 at 07:45

0 Answers0