<Window
    x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.EventVisualizerWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tb="http://www.hardcodet.net/taskbar"
    Height="300"
    Width="300"
    >
    <Window.Resources>
        <Storyboard
            x:Key="ShowMovement"
            AutoReverse="True"
            >
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="MoveIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.1000000"
                    Value="1.2"
                    />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="MoveIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.1000000"
                    Value="1.2"
                    />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard
            x:Key="ShowMouseUp"
            AutoReverse="True"
            >
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="LeftMouseIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.1000000"
                    Value="1.35"
                    />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="LeftMouseIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.1000000"
                    Value="1.35"
                    />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard
            x:Key="ShowToolTipOpened"
            AutoReverse="True"
            >
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="ToolTipIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.2000000"
                    Value="1.4"
                    />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
                BeginTime="00:00:00"
                Storyboard.TargetName="ToolTipIndicator"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                >
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00"
                    Value="1"
                    />
                <SplineDoubleKeyFrame
                    KeyTime="00:00:00.2000000"
                    Value="1.4"
                    />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger
            RoutedEvent="tb:TaskbarIcon.TrayMouseMove"
            SourceName="notifyIcon"
            >
            <BeginStoryboard Storyboard="{StaticResource ShowMovement}" />
        </EventTrigger>
        <EventTrigger
            RoutedEvent="tb:TaskbarIcon.TrayLeftMouseUp"
            SourceName="notifyIcon"
            >
            <BeginStoryboard
                Storyboard="{StaticResource ShowMouseUp}"
                x:Name="ShowMouseUp_BeginStoryboard"
                />
        </EventTrigger>
        <EventTrigger
            RoutedEvent="tb:TaskbarIcon.TrayToolTipOpen"
            SourceName="notifyIcon"
            >
            <BeginStoryboard
                Storyboard="{StaticResource ShowToolTipOpened}"
                x:Name="ShowToolTipOpened_BeginStoryboard"
                />
        </EventTrigger>
    </Window.Triggers>
    <Grid>

        <!--  the NotifyIcon does not need to be configured here - animations were set up in Blend  -->
        <tb:TaskbarIcon
            x:Name="notifyIcon"
            ToolTipText="hello world"
            IconSource="/Icons/Error.ico"
            />


        <Ellipse
            HorizontalAlignment="Left"
            Margin="24,62,0,0"
            VerticalAlignment="Top"
            Width="19"
            Height="19"
            Stroke="#FF549D2D"
            x:Name="MoveIndicator"
            RenderTransformOrigin="0.5,0.5"
            >
            <Ellipse.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1" />
                    <SkewTransform AngleX="0" AngleY="0" />
                    <RotateTransform Angle="0" />
                    <TranslateTransform X="0" Y="0" />
                </TransformGroup>
            </Ellipse.RenderTransform>
            <Ellipse.Fill>
                <LinearGradientBrush EndPoint="0.528,0.694" StartPoint="-0.056,-0.118">
                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                    <GradientStop Color="#FF65A135" Offset="1" />
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse
            Stroke="#FF549D2D"
            HorizontalAlignment="Left"
            Margin="24,106,0,0"
            VerticalAlignment="Top"
            Width="19"
            Height="19"
            x:Name="LeftMouseIndicator"
            RenderTransformOrigin="0.5,0.5"
            >
            <Ellipse.RenderTransform>
                <TransformGroup>
                    <ScaleTransform />
                    <SkewTransform AngleX="0" AngleY="0" />
                    <RotateTransform Angle="0" />
                    <TranslateTransform X="0" Y="0" />
                </TransformGroup>
            </Ellipse.RenderTransform>
            <Ellipse.Fill>
                <LinearGradientBrush EndPoint="0.528,0.694" StartPoint="-0.056,-0.118">
                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                    <GradientStop Color="#FF65A135" Offset="1" />
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse
            Stroke="#FF549D2D"
            HorizontalAlignment="Left"
            Margin="24,0,0,94"
            Width="19"
            x:Name="ToolTipIndicator"
            RenderTransformOrigin="0.5,0.5"
            Height="19"
            VerticalAlignment="Bottom"
            >
            <Ellipse.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1" />
                    <SkewTransform AngleX="0" AngleY="0" />
                    <RotateTransform Angle="0" />
                    <TranslateTransform X="0" Y="0" />
                </TransformGroup>
            </Ellipse.RenderTransform>
            <Ellipse.Fill>
                <LinearGradientBrush EndPoint="0.528,0.694" StartPoint="-0.056,-0.118">
                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                    <GradientStop Color="#FF65A135" Offset="1" />
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <TextBlock
            Margin="63,62,91,0"
            VerticalAlignment="Top"
            Height="19"
            TextWrapping="Wrap"
            >
            <Run
                Language="de-ch"
                Text="TrayMouseMove Event"
                />
        </TextBlock>
        <TextBlock
            Margin="63,106,91,0"
            VerticalAlignment="Top"
            Height="19"
            TextWrapping="Wrap"
            >
            <Run
                Language="de-ch"
                Text="TrayLeftMouseUp Event"
                />
        </TextBlock>
        <TextBlock
            Margin="63,0,91,94"
            TextWrapping="Wrap"
            VerticalAlignment="Bottom"
            Height="19"
            >
            <Run
                Language="de-ch"
                Text="TrayToolTipOpen Event"
                />
        </TextBlock>
        <TextBlock
            Margin="10,10,10,0"
            VerticalAlignment="Top"
            Height="31"
            TextWrapping="Wrap"
            FontWeight="Bold"
            >
            <Run
                Language="de-ch"
                Text="The green ellipses are animated based on routed events of the NotifyIcon"
                />
        </TextBlock>

    </Grid>
</Window>