Files
ShrlAlgoToolkit/WPFluent/Controls/PendingBox/Loading.xaml

92 lines
5.6 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFluent.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:LoadingBackgroundThicknessConverter x:Key="LoadingBackgroundThicknessConverter" />
<local:LoadingLineYConverter x:Key="LoadingLineYConverter" />
<local:LoadingClassicMarginConverter x:Key="LoadingClassicMarginConverter" />
<local:LoadingClassicEllipseSizeConverter x:Key="LoadingClassicEllipseSizeConverter" />
<local:RingProgressBarConverter x:Key="RingProgressBarConverter" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type local:Loading}">
<Setter Property="Height" Value="35" />
<Setter Property="Width" Value="35" />
<Setter Property="LoadingStyle" Value="Ring" />
<Setter Property="Foreground" Value="{DynamicResource SystemAccentColorPrimaryBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:Loading}">
<Grid x:Name="GrdMain">
<Ellipse Stroke="{TemplateBinding Background}" StrokeThickness="{Binding ActualWidth, Converter={StaticResource LoadingBackgroundThicknessConverter}, RelativeSource={RelativeSource AncestorType=local:Loading}}" />
<Path
x:Name="Path"
RenderTransformOrigin="0.5,0.5"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="{Binding ActualWidth, Converter={StaticResource LoadingBackgroundThicknessConverter}, RelativeSource={RelativeSource AncestorType=local:Loading}}">
<Path.Data>
<MultiBinding Converter="{StaticResource RingProgressBarConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource AncestorType=local:Loading}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource AncestorType=local:Loading}" />
<Binding
Converter="{StaticResource LoadingBackgroundThicknessConverter}"
Path="ActualWidth"
RelativeSource="{RelativeSource AncestorType=local:Loading}" />
<Binding Path="Minimum" RelativeSource="{RelativeSource AncestorType=local:Loading}" />
<Binding Path="Maximum" RelativeSource="{RelativeSource AncestorType=local:Loading}" />
<Binding Path="Value" RelativeSource="{RelativeSource AncestorType=local:Loading}" />
</MultiBinding>
</Path.Data>
<Path.RenderTransform>
<RotateTransform x:Name="rotate" Angle="0" />
</Path.RenderTransform>
</Path>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsRunning" Value="True">
<Setter TargetName="GrdMain" Property="Visibility" Value="Visible" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="rotate"
Storyboard.TargetProperty="Angle"
To="360"
Duration="0:0:1" />
<DoubleAnimation
AutoReverse="True"
RepeatBehavior="Forever"
Storyboard.TargetProperty="Value"
From="10"
To="80"
Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="rotate"
Storyboard.TargetProperty="Angle"
Duration="0:0:0" />
<DoubleAnimation Storyboard.TargetProperty="Value" Duration="0:0:0" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>