在XAML中动画省略号

Dre*_*kes 0 .net wpf animation xaml ellipsis

想象一下一些文字:

<TextBlock>Loading...</TextBlock>
Run Code Online (Sandbox Code Playgroud)

我想要一个简单的省略号(...字符)动画,它在它之间振荡.,..并且...在一个缓慢的循环中,以给人一种正在发生的事情的印象.

有没有一种简单的方法在XAML for WPF中执行此操作?

Cle*_*ens 6

纯XAML解决方案可能如下所示:

<TextBlock>
    <TextBlock.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard Duration="0:0:3" RepeatBehavior="Forever">
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Text">
                        <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Loading."/>
                        <DiscreteObjectKeyFrame KeyTime="0:0:1" Value="Loading.."/>
                        <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="Loading..."/>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </TextBlock.Triggers>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)