首页 > 代码库 > WPF:Metro样式ProgressBar

WPF:Metro样式ProgressBar

 <UserControl x:Class="MetroProgressBar.MetroProBar"

  •                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  •                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  •                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  •                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  •                  mc:Ignorable="d"
  •                  d:DesignHeight="300" d:DesignWidth="300">
  •         <UserControl.Resources>
  •             <Storyboard x:Key="StoryLeftToRight" RepeatBehavior="Forever">
  •                 <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e1" Storyboard.TargetProperty="(FrameworkElement.Margin)">
  •                     <SplineThicknessKeyFrame KeyTime="00:00:00.6" Value="275,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:03.1" Value="325,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:03.7" Value="600,0,0,0" />
  •                 </ThicknessAnimationUsingKeyFrames>
  •                 <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e2" Storyboard.TargetProperty="(FrameworkElement.Margin)">
  •                     <SplineThicknessKeyFrame KeyTime="00:00:00.5" Value="20,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:01.1" Value="275,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:03.6" Value="325,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:04.2" Value="590,0,0,0" />
  •                 </ThicknessAnimationUsingKeyFrames>
  •                 <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e3" Storyboard.TargetProperty="(FrameworkElement.Margin)">
  •                     <SplineThicknessKeyFrame KeyTime="00:00:01.0" Value="10,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:01.6" Value="275,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:04.1" Value="325,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:04.7" Value="580,0,0,0" />
  •                 </ThicknessAnimationUsingKeyFrames>
  •                 <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e4" Storyboard.TargetProperty="(FrameworkElement.Margin)">
  •                     <SplineThicknessKeyFrame KeyTime="00:00:01.5" Value="0,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:02.1" Value="275,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:04.5" Value="325,0,0,0" />
  •                     <SplineThicknessKeyFrame KeyTime="00:00:05.1" Value="570,0,0,0" />
  •                 </ThicknessAnimationUsingKeyFrames>
  •             </Storyboard>
  •         </UserControl.Resources>
  •     
  •         <UserControl.Triggers>
  •             <EventTrigger RoutedEvent="FrameworkElement.Loaded">
  •                 <BeginStoryboard Storyboard="{StaticResource StoryLeftToRight}"/>
  •             </EventTrigger>
  •         </UserControl.Triggers>
  •  
  •         <Grid>
  •             <Ellipse Width="5" Height="5" HorizontalAlignment="Left" Margin="30,0,0,0" Fill="White" Name="e1" />
  •             <Ellipse Width="5" Height="5" HorizontalAlignment="Left" Margin="20,0,0,0" Fill="White" Name="e2" />
  •             <Ellipse Width="5" Height="5" HorizontalAlignment="Left" Margin="10,0,0,0" Fill="White" Name="e3" />
  •             <Ellipse Width="5" Height="5" HorizontalAlignment="Left" Margin="0,0,0,0" Fill="White" Name="e4" />
  •         </Grid>
  •     </UserControl>

 

WPF:Metro样式ProgressBar