첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
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

댓글을 달아 주세요