2025-07-31 20:12:01 +08:00
|
|
|
|
<ResourceDictionary
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2025-08-20 12:10:13 +08:00
|
|
|
|
xmlns:internal="clr-namespace:NeumUI.Converters.Internal"
|
|
|
|
|
|
xmlns:svd="clr-namespace:NeumUI.Controls.Decorations"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ControlTemplate TargetType="{x:Type ProgressBar}" x:Key="ProgressHorizontalDefault">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<ControlTemplate.Resources>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Storyboard RepeatBehavior="Forever" x:Key="ProgressIndeterminateHoriziontal">
|
|
|
|
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground.(Brush.RelativeTransform) .(TransformGroup.Children)[3].(TranslateTransform.X)">
|
|
|
|
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="-1" />
|
|
|
|
|
|
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</DoubleAnimationUsingKeyFrames>
|
|
|
|
|
|
</Storyboard>
|
|
|
|
|
|
</ControlTemplate.Resources>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<svd:SlotBorder
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Intensity="0.7"
|
|
|
|
|
|
Padding="2"
|
|
|
|
|
|
x:Name="backgroundBorder">
|
|
|
|
|
|
<Grid HorizontalAlignment="Left" x:Name="BarGrid">
|
|
|
|
|
|
<!-- 计算进度条宽度 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.Width>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<MultiBinding Converter="{StaticResource ResourceKey=ValueToRangeWidth}" ConverterParameter="7">
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Minimum"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Maximum"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Value"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="ActualWidth"
|
|
|
|
|
|
RelativeSource="{RelativeSource AncestorType={x:Type svd:SlotBorder}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiBinding>
|
|
|
|
|
|
</Grid.Width>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 背景模糊效果 -->
|
|
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Foreground}"
|
|
|
|
|
|
CornerRadius="3"
|
|
|
|
|
|
x:Name="borderBlur">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Border.Effect>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BlurEffect Radius="8" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Border.Effect>
|
|
|
|
|
|
</Border>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 进度条 -->
|
|
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Foreground}"
|
|
|
|
|
|
CornerRadius="3"
|
|
|
|
|
|
x:Name="borderProgress" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
</svd:SlotBorder>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsIndeterminate" Value="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Width" TargetName="BarGrid" Value="auto" />
|
|
|
|
|
|
<Setter Property="HorizontalAlignment" TargetName="BarGrid" Value="Stretch" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryIndeterminateGradientBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger.EnterActions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource ProgressIndeterminateHoriziontal}" x:Name="beginIndeterminate" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<RemoveStoryboard BeginStoryboardName="beginIndeterminate" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<!--
|
|
|
|
|
|
Foreground: 控件的 Foreground 属性。
|
|
|
|
|
|
(Brush.RelativeTransform): 这个 Foreground 画刷(Brush)的 RelativeTransform 属性。
|
|
|
|
|
|
(TransformGroup.Children): 这个变换(Transform)的 Children 集合(这隐含地要求 RelativeTransform 必须是一个 TransformGroup)。
|
|
|
|
|
|
[3]: Children 集合中的第四个元素(索引从0开始)。
|
|
|
|
|
|
(TranslateTransform.X): 这个元素的 X 属性(这隐含地要求第四个元素必须是一个 TranslateTransform)。
|
2025-07-11 09:20:23 +08:00
|
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,1" x:Key="PrimaryIndeterminateGradientBrush">
|
|
|
|
|
|
<GradientStop Color="{StaticResource PrimaryDefaultColor}" Offset="0" />
|
|
|
|
|
|
<GradientStop Color="{StaticResource PrimaryVariantColor}" Offset="0.7" />
|
|
|
|
|
|
<GradientStop Color="{StaticResource PrimaryDefaultColor}" Offset="0.8" />
|
|
|
|
|
|
<LinearGradientBrush.RelativeTransform>
|
|
|
|
|
|
<TransformGroup>
|
|
|
|
|
|
<ScaleTransform/>
|
|
|
|
|
|
<SkewTransform/>
|
|
|
|
|
|
<RotateTransform/>
|
|
|
|
|
|
<TranslateTransform/>
|
|
|
|
|
|
</TransformGroup>
|
|
|
|
|
|
</LinearGradientBrush.RelativeTransform>
|
|
|
|
|
|
</LinearGradientBrush>
|
|
|
|
|
|
-->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ControlTemplate TargetType="{x:Type ProgressBar}" x:Key="ProgressVerticalDefault">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<ControlTemplate.Resources>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Storyboard RepeatBehavior="Forever" x:Key="ProgressIndeterminateVertical">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground.(Brush.RelativeTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="1" />
|
|
|
|
|
|
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-1" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</DoubleAnimationUsingKeyFrames>
|
|
|
|
|
|
</Storyboard>
|
|
|
|
|
|
</ControlTemplate.Resources>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<svd:SlotBorder
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Intensity="0.7"
|
|
|
|
|
|
Padding="2"
|
|
|
|
|
|
x:Name="backgroundBorder">
|
|
|
|
|
|
<Grid VerticalAlignment="Bottom" x:Name="BarGrid">
|
|
|
|
|
|
<!-- 计算进度条宽度 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.Height>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="7">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Minimum"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Maximum"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="Value"
|
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
|
<Binding
|
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
|
Path="ActualHeight"
|
|
|
|
|
|
RelativeSource="{RelativeSource AncestorType={x:Type svd:SlotBorder}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiBinding>
|
|
|
|
|
|
</Grid.Height>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 背景模糊效果 -->
|
|
|
|
|
|
<Border Background="{TemplateBinding Foreground}" CornerRadius="3">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Border.Effect>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BlurEffect Radius="8" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Border.Effect>
|
|
|
|
|
|
</Border>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 进度条 -->
|
|
|
|
|
|
<Border Background="{TemplateBinding Foreground}" CornerRadius="3" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</svd:SlotBorder>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsIndeterminate" Value="True">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Height" TargetName="BarGrid" Value="auto" />
|
|
|
|
|
|
<Setter Property="VerticalAlignment" TargetName="BarGrid" Value="Stretch" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryIndeterminateGradientBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger.EnterActions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<BeginStoryboard Storyboard="{StaticResource ProgressIndeterminateVertical}" x:Name="beginIndeterminate" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
|
<Trigger.ExitActions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<RemoveStoryboard BeginStoryboardName="beginIndeterminate" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
|
|
|
|
|
<Style TargetType="{x:Type ProgressBar}">
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryGradientBrush}" />
|
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="Height" Value="20" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="Template" Value="{StaticResource ProgressHorizontalDefault}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<Trigger Property="Orientation" Value="Vertical">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Template" Value="{StaticResource ProgressVerticalDefault}" />
|
|
|
|
|
|
<Setter Property="Width" Value="20" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
|
|
|
|
|
|
<Setter Property="IsIndeterminate" Value="False" />
|
|
|
|
|
|
</Trigger>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</ResourceDictionary>
|