■ EventTrigger 엘리먼트 : Style 엘리먼트 Triggers 속성에서 사용하기

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

<StackPanel

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <StackPanel.Resources>

        <Style TargetType="{x:Type Button}">

            <Setter Property="HorizontalAlignment" Value="Center" />

            <Setter Property="FontSize"            Value="12"     />

            <Style.Triggers>

                <EventTrigger RoutedEvent="Button.MouseEnter">

                    <BeginStoryboard>

                        <Storyboard>

                            <DoubleAnimation

                                Storyboard.TargetProperty="FontSize"

                                Duration="0:0:1"

                                To="36" />

                        </Storyboard>

                    </BeginStoryboard>

                </EventTrigger>

                <EventTrigger RoutedEvent="Button.MouseLeave">

                    <BeginStoryboard>

                        <Storyboard>

                            <DoubleAnimation

                                Storyboard.TargetProperty="FontSize"

                                Duration="0:0:0.25"

                                To="12" />

                        </Storyboard>

                    </BeginStoryboard>

                </EventTrigger>

            </Style.Triggers>

        </Style>

    </StackPanel.Resources>

    <Button>버튼 1</Button>

    <Button>버튼 2</Button>

    <Button>버튼 3</Button>

    <Button>버튼 4</Button>

    <Button>버튼 5</Button>

</StackPanel>

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

Posted by 사용자 icodebroker

댓글을 달아 주세요