Display dot-dot-dot progress in a WPF button

风格不统一 提交于 2019-11-30 13:44:59

The simplest way of doing that is using an ObjectAnimationUsingKeyFrames. Set the TargetProperty on the Content and set the Value of each DiscreteObjectKeyFrame to Reconciling. Reconciling.. Reconciling....

Example for a ControlTemplate with a ContentPresenter named PART_Content:

<ControlTemplate.Triggers>
    <Trigger Property="IsEnabled" Value="False">
        <Trigger.EnterActions>
            <BeginStoryboard>
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Content" Duration="00:00:00.8" RepeatBehavior="Forever">
                        <DiscreteObjectKeyFrame KeyTime="00:00:00.0" Value="Loading"/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="Loading."/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:00.4" Value="Loading.."/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:00.6" Value="Loading..."/>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </Trigger.EnterActions>
    </Trigger>
</ControlTemplate.Triggers>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!