<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:local="clr-namespace:TestProject"
Width="800"
Height="600"
Title="TriggerAction<T> 클래스 : 전경색 변경 액션 사용하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<Storyboard x:Key="hourStoryboard">
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="hourTextBlock"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1.1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseIn" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="minuteStoryboard">
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="minuteTextBlock"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1.1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseIn" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="secondStoryboard">
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="secondTextBlock"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1.1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseIn" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<SineEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Grid>
<Grid
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontSize" Value="100" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- 시 -->
<TextBlock x:Name="hourTextBlock" Grid.Column="0"
RenderTransformOrigin="0.5 1"
Text="00">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</TextBlock.RenderTransform>
<i:Interaction.Triggers>
<local:TextChangedTrigger ChangeTime="23">
<ei:ControlStoryboardAction Storyboard="{StaticResource hourStoryboard}" />
<local:ChangeForegroundAction Foreground="Red" />
</local:TextChangedTrigger>
</i:Interaction.Triggers>
</TextBlock>
<TextBlock Grid.Column="1"
Text=":" />
<!-- 분 -->
<TextBlock x:Name="minuteTextBlock" Grid.Column="2"
RenderTransformOrigin="0.5 1"
Text="00">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</TextBlock.RenderTransform>
<i:Interaction.Triggers>
<local:TextChangedTrigger ChangeTime="10 12 14 16">
<ei:ControlStoryboardAction Storyboard="{StaticResource minuteStoryboard}"/>
<local:ChangeForegroundAction Foreground="Green" />
</local:TextChangedTrigger>
</i:Interaction.Triggers>
</TextBlock>
<TextBlock Grid.Column="3"
Text=":" />
<!-- 초 -->
<TextBlock x:Name="secondTextBlock" Grid.Column="4"
RenderTransformOrigin="0.5 1"
Text="00">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</TextBlock.RenderTransform>
<i:Interaction.Triggers>
<local:TextChangedTrigger ChangeTime="10 20 30 40 50">
<ei:ControlStoryboardAction Storyboard="{StaticResource secondStoryboard}" />
<local:ChangeForegroundAction Foreground="Blue" />
</local:TextChangedTrigger>
</i:Interaction.Triggers>
</TextBlock>
</Grid>
</Grid>
</Window>