<ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:b="http://schemas.microsoft.com/xaml/behaviors">

    <!-- NOTIFICATION ACTION TEMPLATE -->
    <ControlTemplate x:Key="Template.NotificationAction" TargetType="ListBoxItem">

        <!-- Layout for the Action Notification -->
        <Grid
            x:Name="NotificationAction.Layout"
            Width="Auto"
            Height="48">

            <!-- NotificationAction.Base displays the background and outline -->
            <Border
                x:Name="NotificationAction.Base"
                Background="{DynamicResource Color.Background.Notification}"
                BorderBrush="{DynamicResource Color.Border.Notification}"
                BorderThickness="2"
                CornerRadius="4"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                Padding="4,0,24,0">

                <!-- The ContentPresenter displays the content inside the notification -->
                <ContentPresenter
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"/>
            </Border>
        </Grid>

        <ControlTemplate.Triggers>
            <!-- Fade-in effect for the notification -->
            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation
                            Storyboard.TargetName="NotificationAction.Layout"
                            Storyboard.TargetProperty="Opacity"
                            From="0"
                            To="1"
                            Duration="0:0:0.1"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

            <!-- Fade-out effect when notification expires -->
            <DataTrigger Binding="{Binding Expiring}" Value="True">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Storyboard.TargetName="NotificationAction.Layout"
                                Storyboard.TargetProperty="Opacity"
                                From="1"
                                To="0"
                                Duration="0:0:0.1"/>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- NOTIFICATION ACTION STYLE -->
    <Style x:Key="Style.NotificationAction" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ContentControl}}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Margin" Value="0,0,0,8" />
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="Template" Value="{DynamicResource Template.NotificationAction}" />
    </Style>

    <!-- NOTIFICATION ACTION DATA TEMPLATE -->
    <DataTemplate x:Key="DataTemplate.NotificationAction">
        <Grid x:Name="NotificationAction.Content">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="48"/>
                <ColumnDefinition Width="4"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <!-- NotificationAction.Icon displays the action's icon -->
            <Image
                    x:Name="NotificationAction.Icon"
                    Grid.Column="0"
                    Source="{Binding Icon}"
                    Width="24"
                    Height="24"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"/>

            <!-- NotificationAction.Text displays the action's label -->
            <TextBlock
                    x:Name="NotificationAction.Text"
                    Grid.Column="2"
                    Text="{Binding Text}"
                    FontFamily="{DynamicResource Font.CoreSans}"
                    FontSize="{DynamicResource Font.Size.Body}"
                    Foreground="{DynamicResource Color.Text}"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"/>
        </Grid>
    </DataTemplate>
</ResourceDictionary>
