Files
ShrlAlgoToolkit/WPFluent/Controls/ProgressBar/ProgressBar.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

107 lines
6.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlStrongStrokeColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
<Setter Property="Height" Value="4" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid Name="TemplateRoot" SnapsToDevicePixels="True">
<Grid.Style>
<Style TargetType="Grid">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Horizontal">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="0" />
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Vertical">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="1.5"
Margin="1,1,1,1" />
<Rectangle Margin="1,1,1,1" Name="PART_Track" />
<Border
Background="{TemplateBinding Foreground}"
CornerRadius="2"
HorizontalAlignment="Left"
Margin="1,1,1,1"
Name="PART_Indicator" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsIndeterminate" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid Name="TemplateRoot">
<Grid.Style>
<Style TargetType="Grid">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Horizontal">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="0" />
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Vertical">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Border
Background="{DynamicResource ControlFillColorTransparentBrush}"
BorderBrush="{DynamicResource ControlFillColorTransparentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Margin="1,1,1,1" />
<Rectangle Margin="1,1,1,1" Name="PART_Track" />
<Decorator
HorizontalAlignment="Left"
Margin="1,1,1,1"
Name="PART_Indicator">
<Grid ClipToBounds="True" Name="Animation">
<Border
Background="{TemplateBinding Foreground}"
CornerRadius="2"
HorizontalAlignment="Left"
Margin="0,0,0,0"
Name="PART_GlowRect"
Width="200" />
</Grid>
</Decorator>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>