첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ StringAnimationUsingKeyFrames 엘리먼트 : 문자열 교대로 표시하기

------------------------------------------------------------------------------------------------------------------------


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="StringAnimationUsingKeyFrames 엘리먼트 : 문자열 교대로 표시하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid TextBlock.FontSize="192">

        <TextBlock Name="textBlock"

            HorizontalAlignment="Center"

            VerticalAlignment="Center"

            Foreground="Black" />

    </Grid>

    <Window.Triggers>

        <EventTrigger RoutedEvent="Canvas.Loaded">

            <BeginStoryboard>

                <Storyboard

                    TargetName="textBlock"

                    Duration="0:0:2"

                    RepeatBehavior="Forever">

                    <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text">

                        <DiscreteStringKeyFrame KeyTime="0:0:0" Value="EAT" />

                        <DiscreteStringKeyFrame KeyTime="0:0:1" Value="HERE" />

                    </StringAnimationUsingKeyFrames>

                    <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground.Color">

                        <DiscreteColorKeyFrame KeyTime="0:0:0" Value="Red" />

                        <DiscreteColorKeyFrame KeyTime="0:0:1" Value="Blue" />

                    </ColorAnimationUsingKeyFrames>

                </Storyboard>

            </BeginStoryboard>

        </EventTrigger>

    </Window.Triggers>

</Window>

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요