ОК, я заставил это работать!
private void TypewriteTextblock(string textToAnimate, TextBlock txt, TimeSpan timeSpan)
{
Storyboard story = new Storyboard();
story.FillBehavior = FillBehavior.HoldEnd;
story.RepeatBehavior = RepeatBehavior.Forever;
DiscreteStringKeyFrame discreteStringKeyFrame;
StringAnimationUsingKeyFrames stringAnimationUsingKeyFrames = new StringAnimationUsingKeyFrames();
stringAnimationUsingKeyFrames.Duration = new Duration(timeSpan);
string tmp = string.Empty;
foreach(char c in textToAnimate)
{
discreteStringKeyFrame = new DiscreteStringKeyFrame();
discreteStringKeyFrame.KeyTime = KeyTime.Paced;
tmp += c;
discreteStringKeyFrame.Value = tmp;
stringAnimationUsingKeyFrames.KeyFrames.Add(discreteStringKeyFrame);
}
Storyboard.SetTargetName(stringAnimationUsingKeyFrames, txt.Name);
Storyboard.SetTargetProperty(stringAnimationUsingKeyFrames, new PropertyPath(TextBlock.TextProperty));
story.Children.Add(stringAnimationUsingKeyFrames);
story.Begin(txt);
}
Но есть ли способ заставить персонажей исчезать?