兼容win7版应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
18 KiB

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- BoolToVisibility Converter -->
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<!-- 基础加载样式 -->
<Style x:Key="BaseLoadingIndicatorStyle" TargetType="Control">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="#80FFFFFF"
CornerRadius="8"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="20">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar IsIndeterminate="True"
Width="60"
Height="6"
Background="#E0E0E0"
Foreground="#0078D7"
Margin="0,0,0,10"/>
<TextBlock Text="加载中..."
HorizontalAlignment="Center"
Foreground="#666666"
FontSize="14"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 小型加载样式 -->
<Style x:Key="SmallLoadingIndicatorStyle" TargetType="Control" BasedOn="{StaticResource BaseLoadingIndicatorStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="#80FFFFFF"
CornerRadius="4"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="10">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar IsIndeterminate="True"
Width="40"
Height="4"
Background="#E0E0E0"
Foreground="#0078D7"
Margin="0,0,0,5"/>
<TextBlock Text="加载中..."
HorizontalAlignment="Center"
Foreground="#666666"
FontSize="12"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 大型加载样式 -->
<Style x:Key="LargeLoadingIndicatorStyle" TargetType="Control" BasedOn="{StaticResource BaseLoadingIndicatorStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="#80FFFFFF"
CornerRadius="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="30">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar IsIndeterminate="True"
Width="80"
Height="8"
Background="#E0E0E0"
Foreground="#0078D7"
Margin="0,0,0,15"/>
<TextBlock Text="加载中,请稍候..."
HorizontalAlignment="Center"
Foreground="#666666"
FontSize="16"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoadingIndicatorStyle" TargetType="Control">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="#80FFFFFF"
CornerRadius="8"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="20">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar IsIndeterminate="True"
Width="60"
Height="6"
Background="#E0E0E0"
Foreground="#0078D7"
Margin="0,0,0,10"/>
<TextBlock Text="加载中..."
HorizontalAlignment="Center"
Foreground="#666666"
FontSize="14"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 改良版经典旋转圆圈样式 -->
<Style x:Key="ClassicSpinnerStyle" TargetType="Control">
<Setter Property="Foreground" Value="#0078D7"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding Tag}"
Padding="{TemplateBinding Padding}">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<!-- 旋转圆圈 -->
<Grid Width="40" Height="40"
HorizontalAlignment="Center">
<Ellipse x:Name="SpinnerCircle"
Width="32" Height="32"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="3"
StrokeDashArray="1 4"
StrokeDashCap="Round"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<RotateTransform Angle="0"/>
</Ellipse.RenderTransform>
</Ellipse>
<!-- 内圈点缀 -->
<Ellipse Width="8" Height="8"
Fill="{TemplateBinding Foreground}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,2,0,0">
<Ellipse.RenderTransform>
<RotateTransform Angle="0"/>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
<!-- 加载文字 -->
<TextBlock x:Name="LoadingText"
Text="加载中..."
Foreground="#666666"
FontSize="14"
FontWeight="Normal"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<!-- 主圆圈旋转动画 -->
<DoubleAnimation
Storyboard.TargetName="SpinnerCircle"
Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:0.8"
RepeatBehavior="Forever"/>
<!-- 内圈点旋转动画 -->
<DoubleAnimation
Storyboard.TargetName="SpinnerCircle"
Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:0.8"
RepeatBehavior="Forever"/>
<!-- 文字淡入动画 -->
<DoubleAnimation
Storyboard.TargetName="LoadingText"
Storyboard.TargetProperty="Opacity"
From="0" To="1" Duration="0:0:0.3"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 带动态点的旋转样式 -->
<Style x:Key="ClassicSpinnerWithDotsStyle" TargetType="Control">
<Setter Property="Foreground" Value="#0078D7"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding Tag}"
Padding="{TemplateBinding Padding}">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<!-- 旋转容器 -->
<Grid Width="48" Height="48"
Margin="0,0,0,12">
<Ellipse x:Name="MainSpinner"
Width="40" Height="40"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="2.5"
StrokeDashArray="0.8 6"
StrokeDashCap="Round"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<RotateTransform Angle="0"/>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
<!-- 加载文字带动态点 -->
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<TextBlock Text="加载中"
Foreground="#555555"
FontSize="13"
FontWeight="Medium"/>
<TextBlock x:Name="Dot1" Text="." Foreground="#555555" FontSize="16" FontWeight="Bold" Opacity="0.3" Margin="2,0,0,0"/>
<TextBlock x:Name="Dot2" Text="." Foreground="#555555" FontSize="16" FontWeight="Bold" Opacity="0.6" Margin="2,0,0,0"/>
<TextBlock x:Name="Dot3" Text="." Foreground="#555555" FontSize="16" FontWeight="Bold" Opacity="1" Margin="2,0,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<!-- 主圆圈旋转动画 -->
<DoubleAnimation
Storyboard.TargetName="MainSpinner"
Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:1.2"
RepeatBehavior="Forever"/>
<!-- 动态点动画 -->
<DoubleAnimation
Storyboard.TargetName="Dot1"
Storyboard.TargetProperty="Opacity"
From="0.3" To="1" Duration="0:0:0.4"
AutoReverse="True" RepeatBehavior="Forever"/>
<DoubleAnimation
Storyboard.TargetName="Dot2"
Storyboard.TargetProperty="Opacity"
From="0.6" To="1" Duration="0:0:0.4"
BeginTime="0:0:0.2"
AutoReverse="True" RepeatBehavior="Forever"/>
<DoubleAnimation
Storyboard.TargetName="Dot3"
Storyboard.TargetProperty="Opacity"
From="1" To="0.3" Duration="0:0:0.4"
BeginTime="0:0:0.4"
AutoReverse="True" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 简约版旋转样式 -->
<Style x:Key="SimpleSpinnerStyle" TargetType="Control">
<Setter Property="Foreground" Value="#0078D7"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding Tag}"
Padding="{TemplateBinding Padding}">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<!-- 简约旋转圆 -->
<Ellipse x:Name="SimpleSpinner"
Width="28" Height="28"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="2"
StrokeDashArray="1 3"
StrokeDashCap="Round"
RenderTransformOrigin="0.5,0.5"
Margin="0,0,0,10">
<Ellipse.RenderTransform>
<RotateTransform Angle="0"/>
</Ellipse.RenderTransform>
</Ellipse>
<!-- 简约文字 -->
<TextBlock Text="加载中..."
Foreground="#777777"
FontSize="12"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="SimpleSpinner"
Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:0.9"
RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>