<Window x:Class="ChoinkaWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:gif="http://wpfanimatedgif.codeplex.com" 
        xmlns:local="clr-namespace:ChoinkaWPF"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525" Visibility="Visible" AllowsTransparency="True" WindowStyle="None" MouseDown="Window_MouseDown_1" Loaded="Window_Loaded">
    <Window.ContextMenu>
        <ContextMenu>
            <MenuItem Header="O Apce" Click="MenuItem_Click" />
            <MenuItem Header="Dni do wigilii" Click="DniDoWigiliiClick"/>
            <MenuItem Header="Wyłącz/Włącz muzykę" Click="WylaczMuzyke"/>
            <Separator/>
            <MenuItem Header="Zamknij" Click="ZamknijClick"/>
        </ContextMenu>
    </Window.ContextMenu>
    <Window.Background>
        <SolidColorBrush Opacity="0" Color="White"/>
    </Window.Background>
    <Window.Resources>
        <Style x:Key="AnimationImageStyle" TargetType="{x:Type Image}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsVisible}" 
                         Value="True">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                             From="1.0" To="0.1"
                                             Duration="0:0:01"
                                             AutoReverse="True"
                                             RepeatBehavior="0:9:0"
                                             />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <Image x:Name="image" HorizontalAlignment="Left" 
               VerticalAlignment="Top"  
               Source="img\tree.gif" 
               Width="525" Height="350" Stretch="Fill"
               />
        <Image x:Name="image1" HorizontalAlignment="Left" Height="340" Margin="99,10,0,0" VerticalAlignment="Top"
               Source="img\snowflakes.png" Width="347" Style="{StaticResource AnimationImageStyle}"
               Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard BeginTime="0:0:8">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image1" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
        <Image x:Name="image2" HorizontalAlignment="Left" Height="302" Margin="389,100,-304,-52" VerticalAlignment="Top" Width="440"
               gif:ImageBehavior.AnimatedSource="img\carlton2.gif" Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard BeginTime="0:0:27">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image2" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
        <Image x:Name="image3" HorizontalAlignment="Left" Height="152" Margin="135,198,0,0" VerticalAlignment="Top" Width="249"
               Source="img\kids.png" Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard >
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image3" Storyboard.TargetProperty="Visibility" BeginTime="0:0:13">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image3" Storyboard.TargetProperty="Visibility" BeginTime="0:0:16">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Hidden}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
        <Image x:Name="image4" HorizontalAlignment="Left" Height="250" Margin="-113,152,0,-52" VerticalAlignment="Top" Width="398"
               gif:ImageBehavior.AnimatedSource="img\dancer1.gif" Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard BeginTime="0:0:27">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image4" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
        <Image x:Name="image5" HorizontalAlignment="Left" Height="228" Margin="270,138,-87,-16" VerticalAlignment="Top" Width="342"
               gif:ImageBehavior.AnimatedSource="img\dancer2.gif" Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard BeginTime="0:0:27">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image5" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
        <Image x:Name="image6" HorizontalAlignment="Left" Height="188" Margin="135,152,0,0" VerticalAlignment="Top" Width="268"
               gif:ImageBehavior.AnimatedSource="img\dancer3.gif" Visibility="Hidden">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Page.Loaded">
                    <BeginStoryboard>
                        <Storyboard BeginTime="0:0:27">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image6" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
    </Grid>
</Window>
