Files
better-genshin-impact/Build/MicaSetup/Design/Controls/ProgressBar/ProgressBar.xaml

103 lines
6.5 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:design="clr-namespace:MicaSetup.Design"
xmlns:local="clr-namespace:MicaSetup.Design.Controls">
<ResourceDictionary.MergedDictionaries>
<design:ResourceResourceDictionary />
</ResourceDictionary.MergedDictionaries>
<Color x:Key="ProgressBarForeground1">#73EBF3</Color>
<Color x:Key="ProgressBarForeground2">#238EFA</Color>
<Style
x:Key="DefaultProgressBarStyle"
BasedOn="{StaticResource {x:Type ProgressBar}}"
TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="#2196F3" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Height" Value="4" />
<Setter Property="Minimum" Value="0" />
<Setter Property="Maximum" Value="100" />
<Setter Property="local:ProgressBarHelper.Foreground1" Value="{StaticResource ProgressBarForeground1}" />
<Setter Property="local:ProgressBarHelper.Foreground2" Value="{StaticResource ProgressBarForeground2}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="1">
<Grid x:Name="PART_Track">
<Rectangle
x:Name="PART_Indicator"
Height="{TemplateBinding Height}"
HorizontalAlignment="Left"
RadiusX="1"
RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStopCollection>
<GradientStop Offset="0" Color="{Binding Path=(local:ProgressBarHelper.Foreground1), RelativeSource={RelativeSource AncestorType=ProgressBar}, Mode=OneWay, FallbackValue={StaticResource ProgressBarForeground1}}" />
<GradientStop Offset="1" Color="{Binding Path=(local:ProgressBarHelper.Foreground2), RelativeSource={RelativeSource AncestorType=ProgressBar}, Mode=OneWay, FallbackValue={StaticResource ProgressBarForeground2}}" />
</GradientStopCollection>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle
x:Name="PART_IndeterminateIndicator"
Width="100"
Height="{TemplateBinding Height}"
HorizontalAlignment="Left"
RadiusX="1"
RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStopCollection>
<GradientStop Offset="0" Color="{Binding Path=(local:ProgressBarHelper.Foreground1), RelativeSource={RelativeSource AncestorType=ProgressBar}, Mode=OneWay, FallbackValue={StaticResource ProgressBarForeground1}}" />
<GradientStop Offset="1" Color="{Binding Path=(local:ProgressBarHelper.Foreground2), RelativeSource={RelativeSource AncestorType=ProgressBar}, Mode=OneWay, FallbackValue={StaticResource ProgressBarForeground2}}" />
</GradientStopCollection>
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<ThicknessAnimation
BeginTime="0:0:0.5"
Storyboard.TargetName="PART_IndeterminateIndicator"
Storyboard.TargetProperty="Margin"
From="0,0,0,0"
To="450,0,0,0"
Duration="0:0:2" />
<DoubleAnimation
Storyboard.TargetName="PART_IndeterminateIndicator"
Storyboard.TargetProperty="Width"
From="0"
To="100"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="True">
<Setter TargetName="PART_Indicator" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_IndeterminateIndicator" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsIndeterminate" Value="False">
<Setter TargetName="PART_Indicator" Property="Visibility" Value="Visible" />
<Setter TargetName="PART_IndeterminateIndicator" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource DefaultProgressBarStyle}" TargetType="{x:Type ProgressBar}" />
</ResourceDictionary>