Display dot-dot-dot progress in a WPF button

前端 未结 1 661
北海茫月
北海茫月 2021-01-02 15:49

I found quite a few examples for showing progress where the progress bars and wheels are used however; I could find only one javascript example to show an ellipsis (dot-dot-

相关标签:
1条回答
  • 2021-01-02 16:13

    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>
    
    0 讨论(0)
提交回复
热议问题