첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ DoubleAnimationUsingKeyFrames 엘리먼트를 사용해 문자열을 교대로 표시하는 방법을 보여준다.

TestProject.zip
다운로드

▶ MainWindow.xaml

<Window
    x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="DoubleAnimationUsingKeyFrames 엘리먼트 : 문자열 교대로 표시하기">
    <Grid TextBlock.FontSize="192">
        <TextBlock Name="eatTextBlock"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Foreground="Red"
            Text="EAT" />
        <TextBlock Name="hereTextBlock"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Foreground="Blue"
            Opacity="0"
            Text="HERE" />
    </Grid>
    <Window.Triggers>
        <EventTrigger RoutedEvent="Canvas.Loaded">
            <BeginStoryboard>
                <Storyboard
                    TargetProperty="Opacity"
                    RepeatBehavior="Forever">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="eatTextBlock">
                        <DiscreteDoubleKeyFrame KeyTime="0:0:1" Value="0" />
                        <DiscreteDoubleKeyFrame KeyTime="0:0:2" Value="1" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="hereTextBlock">
                        <DiscreteDoubleKeyFrame KeyTime="0:0:1" Value="1" />
                        <DiscreteDoubleKeyFrame KeyTime="0:0:2" Value="0" />
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Window.Triggers>
</Window>
728x90
그리드형(광고전용)
Posted by icodebroker
,