Files
TheXamlGuy/UI/WPF.Controls/Countdown/Countdown.xaml
T
2022-11-01 15:26:08 +00:00

155 lines
11 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:TheXamlGuy.UI.WPF.Controls">
<Style TargetType="controls:Countdown">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Countdown">
<Grid x:Name="Container">
<Grid
x:Name="TextRoot"
Opacity="0"
RenderTransformOrigin="0.5,0.5">
<TextBlock x:Name="TextBlock" />
<Grid.RenderTransform>
<ScaleTransform x:Name="ScaleTransform" />
</Grid.RenderTransform>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CountdownStates">
<VisualState x:Name="Pending" />
<VisualState x:Name="TenSecond">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextBlock" Storyboard.TargetProperty="(TextBlock.Text)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="10" />
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="9" />
<DiscreteObjectKeyFrame KeyTime="00:00:02" Value="8" />
<DiscreteObjectKeyFrame KeyTime="00:00:03" Value="7" />
<DiscreteObjectKeyFrame KeyTime="00:00:04" Value="6" />
<DiscreteObjectKeyFrame KeyTime="00:00:05" Value="5" />
<DiscreteObjectKeyFrame KeyTime="00:00:06" Value="4" />
<DiscreteObjectKeyFrame KeyTime="00:00:07" Value="3" />
<DiscreteObjectKeyFrame KeyTime="00:00:08" Value="2" />
<DiscreteObjectKeyFrame KeyTime="00:00:09" Value="1" />
<DiscreteObjectKeyFrame KeyTime="00:00:10" Value="1" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="10x"
Storyboard.TargetName="TextRoot"
Storyboard.TargetProperty="(UIElement.Opacity)">
<LinearDoubleKeyFrame KeyTime="0" Value="0.0" />
<LinearDoubleKeyFrame KeyTime="00:00:00.167" Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="10x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleX">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="10x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleY">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="FiveSecond">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextBlock" Storyboard.TargetProperty="(TextBlock.Text)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="5" />
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="4" />
<DiscreteObjectKeyFrame KeyTime="00:00:02" Value="3" />
<DiscreteObjectKeyFrame KeyTime="00:00:03" Value="2" />
<DiscreteObjectKeyFrame KeyTime="00:00:04" Value="1" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="5x"
Storyboard.TargetName="TextRoot"
Storyboard.TargetProperty="(UIElement.Opacity)">
<LinearDoubleKeyFrame KeyTime="0" Value="0.0" />
<LinearDoubleKeyFrame KeyTime="00:00:00.167" Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="5x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleX">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="5x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleY">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="TwoSecond">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextBlock" Storyboard.TargetProperty="(TextBlock.Text)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="2" />
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="1" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="2x"
Storyboard.TargetName="TextRoot"
Storyboard.TargetProperty="(UIElement.Opacity)">
<LinearDoubleKeyFrame KeyTime="0" Value="0.0" />
<LinearDoubleKeyFrame KeyTime="00:00:00.167" Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="2x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleX">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
RepeatBehavior="2x"
Storyboard.TargetName="ScaleTransform"
Storyboard.TargetProperty="ScaleY">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.5" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:01" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>