码迷,mamicode.com
首页 > Windows程序 > 详细

WPF 简单的绕圈进度条(无cs代码)

时间:2018-05-14 23:00:41      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:names   实现   origin   get   lis   class   ack   oca   pre   

方案: 图标位置不变化的情况下设置透明度实现

技术分享图片

代码:

<Window
    x:Class="WpfApp1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
    xmlns:local="clr-namespace:WpfApp1"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    Width="300"
    Height="300"
    mc:Ignorable="d">

    <Window.Resources>
        <Duration x:Key="AnimationTime">0:0:.84</Duration>
    </Window.Resources>
    <Grid Background="Gray">
        <Ellipse
            x:Name="ellipse"
            Width="80"
            Height="80"
            RenderTransformOrigin="0.5,0.5" />
        <ec:PathListBox HorizontalAlignment="Left" VerticalAlignment="Top">
            <ec:PathListBox.LayoutPaths>
                <ec:LayoutPath Distribution="Even" SourceElement="{Binding ElementName=ellipse}" />
            </ec:PathListBox.LayoutPaths>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.770"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.700"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.630"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.560"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.490"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.420"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:.350"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:0.280"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:0.210"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:0.140"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:0.7"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
            <Ellipse
                Width="15"
                Height="15"
                Fill="White">
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Window.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    BeginTime="0:0:0"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="Opacity"
                                    From=".2"
                                    To="1"
                                    Duration="{StaticResource AnimationTime}" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Ellipse.Triggers>
            </Ellipse>
        </ec:PathListBox>
    </Grid>
</Window>

 

WPF 简单的绕圈进度条(无cs代码)

标签:names   实现   origin   get   lis   class   ack   oca   pre   

原文地址:https://www.cnblogs.com/lonelyxmas/p/9038431.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!