첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형
728x170

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="EventTrigger 엘리먼트 : RoutedEvent 속성을 사용해 복권 긁는 효과 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid
        Width="500"
        Height="500"
        Background="RoyalBlue">
        <Image
            Width="500"
            Height="500"
            Stretch="Fill"
            Source="sample.jpg" />
        <WrapPanel SnapsToDevicePixels="True">
            <WrapPanel.Resources>
                <Style TargetType="Rectangle">
                    <Setter Property="Width"  Value="50"    />
                    <Setter Property="Height" Value="50"    />
                    <Setter Property="Fill"   Value="Black" />
                    <Style.Triggers>
                        <EventTrigger RoutedEvent="Rectangle.MouseEnter">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard Storyboard.TargetProperty="(Rectangle.Opacity)">
                                        <DoubleAnimation To="0" Duration="0:0:0.5"/>
                                        <ColorAnimation
                                            Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"
                                            To="White"
                                            Duration="0:0:0.5" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                    </Style.Triggers>
                </Style>
            </WrapPanel.Resources>
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
            <Rectangle /><Rectangle /><Rectangle /><Rectangle /><Rectangle />
        </WrapPanel>
    </Grid>
</Window>
728x90
반응형
그리드형
Posted by 사용자 icodebroker

댓글을 달아 주세요