259 lines
18 KiB
XML
259 lines
18 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:converters="clr-namespace:AntDesignWPF.Converters"
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
|
xmlns:helpers="clr-namespace:AntDesignWPF.Helpers">
|
|
<sys:Double x:Key="ProgressContentMinWidth">63.0</sys:Double>
|
|
<!--<SolidColorBrush Color="#FF06B025" x:Key="ProgressBar.Progress" />-->
|
|
<!--<SolidColorBrush Color="#FFE6E6E6" x:Key="ProgressBar.Background" />-->
|
|
<!--<SolidColorBrush Color="#FFBCBCBC" x:Key="ProgressBar.Border" />-->
|
|
<Style TargetType="{x:Type ProgressBar}">
|
|
<Setter Property="Background" Value="{DynamicResource AntDesign.Brush.BorderSecondary}" />
|
|
<Setter Property="BorderBrush" Value="{StaticResource AntDesign.Brush.BorderPrimary}" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="MinHeight" Value="15" />
|
|
<Setter Property="ClipToBounds" Value="False" />
|
|
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.Primary}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
|
|
|
<Grid x:Name="TemplateRoot">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition />
|
|
<ColumnDefinition Width="auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Border BorderThickness="{TemplateBinding BorderThickness}" />
|
|
<!--进度条背景轨道-->
|
|
<Rectangle
|
|
x:Name="PART_Track"
|
|
Height="8"
|
|
Fill="{TemplateBinding Background}"
|
|
RadiusX="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualHeight, Converter={converters:MathConverter Operation=Divide}, ConverterParameter=2}"
|
|
RadiusY="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualHeight, Converter={converters:MathConverter Operation=Divide}, ConverterParameter=2}" />
|
|
<Border
|
|
Height="8"
|
|
VerticalAlignment="Center"
|
|
ClipToBounds="True"
|
|
CornerRadius="{Binding Height, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={converters:DoubleToCornerRadiusConverter}, ConverterParameter=2}">
|
|
|
|
<Grid
|
|
x:Name="PART_Indicator"
|
|
HorizontalAlignment="Left"
|
|
ClipToBounds="True">
|
|
<Rectangle
|
|
x:Name="Indicator"
|
|
Fill="{TemplateBinding Foreground}"
|
|
RadiusX="{Binding ElementName=PART_Track, Path=RadiusX}"
|
|
RadiusY="{Binding ElementName=PART_Track, Path=RadiusY}" />
|
|
<!--不确定进度-->
|
|
<Rectangle
|
|
x:Name="Animation"
|
|
Fill="{TemplateBinding Foreground}"
|
|
RadiusX="{Binding ElementName=PART_Track, Path=RadiusX}"
|
|
RadiusY="{Binding ElementName=PART_Track, Path=RadiusY}"
|
|
RenderTransformOrigin="0.5,0.5">
|
|
<Rectangle.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform />
|
|
<SkewTransform />
|
|
<RotateTransform />
|
|
<TranslateTransform />
|
|
</TransformGroup>
|
|
</Rectangle.RenderTransform>
|
|
</Rectangle>
|
|
</Grid>
|
|
</Border>
|
|
<TextBlock
|
|
x:Name="ValueContent"
|
|
Grid.Column="1"
|
|
Margin="4,-2,0,0"
|
|
VerticalAlignment="Center"
|
|
Foreground="{DynamicResource AntDesign.Brush.TextPrimary}"
|
|
Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Value, StringFormat='\{0:F0}%'}" />
|
|
<Grid
|
|
Name="pathDone"
|
|
Grid.Column="1"
|
|
Width="14"
|
|
Height="14"
|
|
Margin="4,0"
|
|
VerticalAlignment="Center"
|
|
Visibility="Collapsed">
|
|
<Ellipse
|
|
Width="14"
|
|
Height="14"
|
|
Fill="{DynamicResource AntDesign.Brush.Success}" />
|
|
<Path
|
|
Height="6"
|
|
Data="M16.3819 8.27342H15.2827C15.0436 8.27342 14.8163 8.38827 14.6757 8.58514L10.9913 13.6945L9.32252 11.3789C9.18189 11.1844 8.95689 11.0672 8.71549 11.0672H7.61626C7.46392 11.0672 7.37486 11.2406 7.46392 11.3648L10.3842 15.4148C10.4532 15.5111 10.5442 15.5896 10.6495 15.6437C10.7549 15.6978 10.8717 15.7261 10.9901 15.7261C11.1086 15.7261 11.2253 15.6978 11.3307 15.6437C11.436 15.5896 11.527 15.5111 11.596 15.4148L16.5319 8.57108C16.6233 8.44686 16.5343 8.27342 16.3819 8.27342Z"
|
|
Fill="White"
|
|
Stretch="Uniform"
|
|
StrokeThickness="30" />
|
|
</Grid>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Determinate" />
|
|
<VisualState x:Name="Indeterminate">
|
|
<Storyboard RepeatBehavior="Forever">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.25" />
|
|
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25" />
|
|
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25" />
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<PointAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
|
|
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5" />
|
|
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5" />
|
|
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5" />
|
|
</PointAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Orientation" Value="Vertical">
|
|
<Setter TargetName="TemplateRoot" Property="LayoutTransform">
|
|
<Setter.Value>
|
|
<RotateTransform Angle="-90" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<Trigger Property="IsIndeterminate" Value="true">
|
|
<Setter TargetName="Indicator" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="ValueContent" Property="Visibility" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Value" Value="100">
|
|
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.Success}" />
|
|
<Setter TargetName="ValueContent" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="pathDone" Property="Visibility" Value="Visible" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style x:Key="Ant.CircularProgressBar" TargetType="ProgressBar">
|
|
<Setter Property="BorderThickness" Value="4" />
|
|
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.Primary}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
|
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Width}">
|
|
<TextBlock
|
|
x:Name="ValueContent"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontSize="22"
|
|
Foreground="{DynamicResource AntDesign.Brush.TextPrimary}"
|
|
Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Value, StringFormat='\{0:F0}%'}" />
|
|
<Grid
|
|
x:Name="PathGrid"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch" />
|
|
|
|
<Canvas>
|
|
<!--进度条背景轨道-->
|
|
<Path
|
|
Canvas.Left="2"
|
|
Canvas.Top="2"
|
|
Stroke="{DynamicResource AntDesign.Brush.BorderSecondary}"
|
|
StrokeThickness="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=BorderThickness.Left}">
|
|
<Path.Data>
|
|
<PathGeometry>
|
|
<PathFigure StartPoint="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:StartPointConverter}, Mode=OneWay}">
|
|
<ArcSegment Size="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:ArcSizeConverter}, Mode=OneWay}" SweepDirection="Clockwise">
|
|
<ArcSegment.Point>
|
|
<MultiBinding Converter="{converters:ArcEndPointConverter}" ConverterParameter="{x:Static converters:ArcEndPointConverter.ParameterMidPoint}">
|
|
<Binding ElementName="PathGrid" Path="ActualWidth" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Minimum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
</MultiBinding>
|
|
</ArcSegment.Point>
|
|
</ArcSegment>
|
|
<ArcSegment Size="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:ArcSizeConverter}, Mode=OneWay}" SweepDirection="Clockwise">
|
|
<ArcSegment.Point>
|
|
<MultiBinding Converter="{converters:ArcEndPointConverter}">
|
|
<Binding ElementName="PathGrid" Path="ActualWidth" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Minimum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
</MultiBinding>
|
|
</ArcSegment.Point>
|
|
</ArcSegment>
|
|
</PathFigure>
|
|
</PathGeometry>
|
|
</Path.Data>
|
|
</Path>
|
|
|
|
<Path
|
|
x:Name="CurrentPath"
|
|
Canvas.Left="2"
|
|
Canvas.Top="2"
|
|
Stroke="{TemplateBinding Foreground}"
|
|
StrokeEndLineCap="Round"
|
|
StrokeLineJoin="Round"
|
|
StrokeStartLineCap="Round"
|
|
StrokeThickness="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=BorderThickness.Left}">
|
|
<Path.Data>
|
|
<PathGeometry>
|
|
<PathFigure StartPoint="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:StartPointConverter}, Mode=OneWay}">
|
|
<ArcSegment Size="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:ArcSizeConverter}, Mode=OneWay}" SweepDirection="Clockwise">
|
|
<ArcSegment.Point>
|
|
<MultiBinding Converter="{converters:ArcEndPointConverter}" ConverterParameter="{x:Static converters:ArcEndPointConverter.ParameterMidPoint}">
|
|
<Binding ElementName="PathGrid" Path="ActualWidth" />
|
|
<Binding Path="Value" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Minimum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
</MultiBinding>
|
|
</ArcSegment.Point>
|
|
</ArcSegment>
|
|
<ArcSegment Size="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:ArcSizeConverter}, Mode=OneWay}" SweepDirection="Clockwise">
|
|
<ArcSegment.Point>
|
|
<MultiBinding Converter="{converters:ArcEndPointConverter}">
|
|
<Binding ElementName="PathGrid" Path="ActualWidth" />
|
|
<Binding Path="Value" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Minimum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
<Binding Path="Maximum" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
</MultiBinding>
|
|
</ArcSegment.Point>
|
|
</ArcSegment>
|
|
</PathFigure>
|
|
</PathGeometry>
|
|
</Path.Data>
|
|
</Path>
|
|
</Canvas>
|
|
|
|
<Viewbox
|
|
Margin="22"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center">
|
|
<!-- 打勾 -->
|
|
<Path
|
|
Name="pathDone"
|
|
Width="24"
|
|
Height="24"
|
|
Data="M21.3745 4.45312H19.7362C19.5065 4.45312 19.2885 4.55859 19.1479 4.73906L9.48462 16.9805L4.85103 11.1094C4.78093 11.0204 4.69159 10.9484 4.5897 10.8989C4.48781 10.8494 4.37603 10.8236 4.26274 10.8234H2.62446C2.46743 10.8234 2.38071 11.0039 2.47681 11.1258L8.89634 19.2586C9.19634 19.6383 9.7729 19.6383 10.0752 19.2586L21.5221 4.75313C21.6182 4.63359 21.5315 4.45312 21.3745 4.45312Z"
|
|
Fill="{DynamicResource AntDesign.Brush.Success}"
|
|
StrokeThickness="30"
|
|
Visibility="Hidden" />
|
|
</Viewbox>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding ElementName=PathGrid, Path=ActualWidth, Converter={converters:LessThanConverter}, ConverterParameter={StaticResource ProgressContentMinWidth}}" Value="True">
|
|
<Setter TargetName="ValueContent" Property="Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
<Trigger Property="Value" Value="100">
|
|
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.Success}" />
|
|
<Setter TargetName="ValueContent" Property="Visibility" Value="Collapsed" />
|
|
<Setter TargetName="pathDone" Property="Visibility" Value="Visible" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
</ResourceDictionary>
|